package com.yixun.qfbao.controller;

import com.qiaofang.common.util.UuidUtil;
import com.yixun.common.page.Page;
import com.yixun.qfbao.annotations.Domain;
import com.yixun.qfbao.annotations.ForbidRepeatClick;
import com.yixun.qfbao.api.service.MyService;
import com.yixun.qfbao.apidto.*;
import com.yixun.qfbao.apidto.base.CommonReqDTO;
import com.yixun.qfbao.apidto.base.CommonResDTO;
import com.yixun.qfbao.config.FileConfig;
import com.yixun.qfbao.constants.ApiConstant;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.exception.ChannelException;
import com.yixun.qfbao.hander.*;
import com.yixun.qfbao.model.*;
import com.yixun.qfbao.model.dto.FlowRecordDto;
import com.yixun.qfbao.util.QiNiuUtil;
import com.yixun.qfbao.utils.*;
import com.yixun.qfbao.vo.*;
import com.yixun.qfbao.xf.model.dto.PremisesDto;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.awt.image.BufferedImage;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
@ResponseBody
@RequestMapping("/api")
public class ApiController {
	
	private static final Logger logger = LoggerFactory.getLogger(ApiController.class);

	@Autowired
	private GetChangeDeptTreeHandler getChangeDeptTreeHandler;

	@Autowired
	private GetLogoHander getLogoHander;
	
	@Autowired
	private LoginHander loginHander;
	
	@Autowired
	private LoginOutHander loginOutHander;
	
	@Autowired
	private GetMenuHander getMenuHander;
	
	@Autowired
	private GetUserAuthListHander getUserAuthListHander;
	
	@Autowired
	private GetAssistantAppIndexHander getAssistantAppIndexHander;
	
	@Autowired
	private GetCPStatisticsByPremisesHander getCPStatisticsByPremisesHander;
	
	@Autowired
	private GetAgencyPcIndexHander getAgencyPcIndexHander;
	
	@Autowired
	private GetOptAuthHander getOptAuthHander;
	
	@Autowired
	private GetAreaHander getAreaHander;
	
	@Autowired
	private GetCityHander getCityHander;
	
	@Autowired
	private GetProvinceHander getProvinceHander;
	
	@Autowired
	private GetFilesHander getFilesHander;
	
	@Autowired
	private FileConfig fileConfig;
	
	@Autowired
	private GetCaseMemberListHander getCaseMemberListHander;
	
	@Autowired
	private GetPremisesCMListHander getPremisesCMListHander;
	
	@Autowired
	private GetPremisesListHander getPremisesListHander;
	
	@Autowired
	private GetAgentPremisesPageHander getAgentPremisesPageHander;
	
	@Autowired
	private GetPremisesWithCRHander getPremisesWithCRHander;
	
	@Autowired
	private GetCaseMemberPageHander getCaseMemberPageHander;
	
	@Autowired
	private GetBindPremisesHander getBindPremisesHander;

	@Autowired
	private GetPremisesListForPartnerHander getPremisesListForPartnerHander;
	
	@Autowired
	private GetPartnerUnBindPremisesHander getPartnerUnBindPremisesHander;
	
	@Autowired
	private BindPartnerToPremisesHander bindPartnerToPremisesHander;
	@Autowired
	private UnbindPartnerToPremisesHander unbindPartnerToPremisesHander;
	
	@Autowired
	private AddPremisesHander addPremisesHander;
	
	@Autowired
	private EditPremisesHander editPremisesHander;
	
	@Autowired
	private AuditPremisesHander auditPremisesHander;
	
	@Autowired
	private ChangeShelvesStatusHander changeShelvesStatusHander;
	
	@Autowired
	private ChangePremisesSaleStatusHander changePremisesSaleStatusHander;
	
	@Autowired
	private AssignPremisesAgentHander assignPremisesAgentHander;
	
	@Autowired
	private GetPremisesDetailHander getPremisesDetailHander;
	
	@Autowired
	private CheckPremisesValidHander checkPremisesValidHander;
	
	@Autowired
	private GetPremisesDynamicPageHander getPremisesDynamicPageHander;
	
	@Autowired
	private AddPremisesDynamicHander addPremisesDynamicHander;
	
	@Autowired
	private EditPremisesDynamicHander editPremisesDynamicHander;
	
	@Autowired
	private GetPremisesDynamicDetailHander getPremisesDynamicDetailHander;
	
	@Autowired
	private GetPremisesHxtHander getPremisesHxtHander;
	
	@Autowired
	private ExportCPHander exportCPHander;
	
	@Autowired
	private GetCPPageHander getCPPageHander;

	@Autowired
    private GetAssistantReportPageHander getAssistantReportPageHander;

    @Autowired
    private GetAssistantAppReportPageHander getAssistantAppReportPageHander;
	
	@Autowired
	private GetCPAppealPageHander getCPAppealPageHander;
	
	@Autowired
	private AgencyReportHander agencyReportHander;
	
	@Autowired
	private ReportAgainHander reportAgainHander;
	
	@Autowired
	private AddReportHander addReportHander;
	
	@Autowired
	private CompletePhoneHander completePhoneHander;
	
	@Autowired
	private AuditCPHander auditCPHander;

	@Autowired
	private ResetAuditHander resetAuditHander;
	
	@Autowired
	private AuditCPAppealHander auditCPAppealHander;
	
	@Autowired
	private ChangeCPConfirmHander changeCPConfirmHander;

	@Autowired
	private ResetConfirmHander resetConfirmHander;
	
	@Autowired
	private ChangeCPMortgageHander changeCPMortgageHander;
	
	@Autowired
	private DistCPAgentHander distCPAgentHander;
	
	@Autowired
	private EditCPCusInfoHander editCPCusInfoHander;
	
	@Autowired
	private GetCPDetailHander getCPDetailHander;
	
	@Autowired
	private GetCPFollowListHander getCPFollowListHander;
	
	@Autowired
	private GetCPFollowStatusListHander getCPFollowStatusListHander;
	
	@Autowired
	private AddFollowHander addFollowHander;
	
	@Autowired
	private IsInSpecialTimeHander isInSpecialTimeHander;
	
	@Autowired
	private CreateQRCodeHander createQRCodeHander;
	
	@Autowired
	private GetWeiXinJsTicketHander getWeiXinJsTicketHander;
	
	@Autowired
	private GetCPToM2InfoHander getCPToM2InfoHander;
	
	@Autowired
	private GetPremisesByM2Hander getPremisesByM2Hander;
	
	@Autowired
	private CustomerToM2Hander customerToM2Hander;
	
	@Autowired
	private GetBaseCodeTypeHander getBaseCodeTypeHander;
	
	@Autowired
	private GetBaseCodeTypeTreeHander getBaseCodeTypeTreeHander;
	
	@Autowired
	private AddBaseCodeTypeHander addBaseCodeTypeHander;
	
	@Autowired
	private EditBaseCodeTypeHander editBaseCodeTypeHander;
	
	@Autowired
	private DelBaseCodeTypeHander delBaseCodeTypeHander;
	
	@Autowired
	private GetBaseCodeValueListHander getBaseCodeValueListHander;
	
	@Autowired
	private GetBaseCodeValuePageHander getBaseCodeValuePageHander;
	
	@Autowired
	private AddBaseCodeValueHander addBaseCodeValueHander;
	
	@Autowired
	private EditBaseCodeValueHander editBaseCodeValueHander;
	
	@Autowired
	private DelBaseCodeValueHander delBaseCodeValueHander;
	
	@Autowired
	private GetChannelRoleListHander getChannelRoleListHander;
	
	@Autowired
	private GetChannelRolePageHander getChannelRolePageHander;
	
	@Autowired
	private GetRoleByIdHander getRoleByIdHander;
	
	@Autowired
	private AddChannelRoleHander addChannelRoleHander;
	
	@Autowired
	private EditChannelRoleHander editChannelRoleHander;
	
	@Autowired
	private DelChannelRoleHander delChannelRoleHander;
	
	@Autowired
	private GetCustomerPremisesHander getCustomerPremisesHander;
	
	@Autowired
	private GetPremisesCommissionHander getPremisesCommissionHander;
	
	@Autowired
	private GetOrgCommissionPageHander getOrgCommissionPageHander;
	
	@Autowired
	private DealCommissionHander dealCommissionHander;
	
	@Autowired
	private GetSettlementRecordHander getSettlementRecordHander;
	
	@Autowired
	private AddCRHander addCRHander;
	
	@Autowired
	private UpdateCRHander updateCRHander;
	
	@Autowired
	private GetCRDetailHander getCRDetailHander;
	
	@Autowired
	private ToUpdateCRHander toUpdateCRHander;
	
	@Autowired
	private AddDeptHander addDeptHander;
	
	@Autowired
	private EditDeptHander editDeptHander;
	
	@Autowired
	private DelDeptHander delDeptHander;
	
	@Autowired
	private AddAgentDeptHander addAgentDeptHander;
	
	@Autowired
	private EditAgentDeptHander editAgentDeptHander;
	
	@Autowired
	private GetDeptByIdHander getDeptByIdHander;
	
	@Autowired
	private GetDeptTreeHander getDeptTreeHander;
	
	@Autowired
	private GetAgentOrgByDevOrgHander getAgentOrgByDevOrgHander;
	
	@Autowired
	private GetAgentOrgByPremisesHander getAgentOrgByPremisesHander;
	
	@Autowired
	private AddAgentOrgHander addAgentOrgHander;
	
	@Autowired
	private UpdateAgentOrgHander updateAgentOrgHander;
	
	@Autowired
	private GetAgentOrgTreeHander getAgentOrgTreeHander;
	
	@Autowired
	private GetAgentOrgAuditPageHander getAgentOrgAuditPageHander;
	
	@Autowired
	private AgentOrgAuditHander agentOrgAuditHander;
	
	@Autowired
	private GetAgentOrgByCompanyListHander getAgentOrgByCompanyListHander;
	
	@Autowired
	private GetAgentOrgCountByCompanyHander getAgentOrgCountByCompanyHander;
	
	@Autowired
	private ImportOrgHander importOrgHander;
	
	@Autowired
	private GetAgentOrgByCompanyCodeHander getAgentOrgByCompanyCodeHander;
	
	@Autowired
	private BindCompanyCodeHander bindCompanyCodeHander;
	
	@Autowired
	private GetCompanyByUserIdHander getCompanyByUserIdHander;
	
	@Autowired
	private GetCompanyForCommissionRuleHander getCompanyForCommissionRuleHander;
	
	@Autowired
	private ResetPwdHander resetPwdHander;

	@Autowired
	private ResetPwdByForgetHander resetPwdByForgetHander;
	
	@Autowired
	private UpdatePwdHander updatePwdHander;
	
	@Autowired
	private DelPartnerHander delPartnerHander;
	
	@Autowired
	private ForbiddenOrNotPartnerHander forbiddenOrNotPartnerHander;
	
	@Autowired
	private GetDevPartnerPageHander getDevPartnerPageHander;

	@Autowired
	private GetDevNewPartnerPageHander getDevNewPartnerPageHander;
	
	@Autowired
	private GetAgentPartnerPageHander getAgentPartnerPageHander;
	
	@Autowired
	private AddPartnerHander addPartnerHander;
	
	@Autowired
	private AddPartnerQuickHander addPartnerQuickHander;
	
	@Autowired
	private EditPartnerHander editPartnerHander;
	
	@Autowired
	private GetPartnerByCompanyHander getPartnerByCompanyHander;
	
	@Autowired
	private GetPartnerByPremisesHander getPartnerByPremisesHander;
	
	@Autowired
	private GetPartnerByAgentOrgHander getPartnerByAgentOrgHander;
	
	@Autowired
	private GetPartnerCountByAgentOrgHander getPartnerCountByAgentOrgHander;
	
	@Autowired
	private GetPartnerByDeptHander getPartnerByDeptHander;
	
	@Autowired
	private GetUserByIdHander getUserByIdHander;
	
	@Autowired
	private GetPartnerDetailHander getPartnerDetailHander;
	
	@Autowired
	private ImportUserHander importUserHander;
	
	@Autowired
	private ExportPartnerHander exportPartnerHander;
	
	@Autowired
	private AuthorizeRoleHander authorizeRoleHander;
	
	@Autowired
	private GetAuthorizeRoleListHander getAuthorizeRoleListHander;
	
	@Autowired
	private GetAgentRankPageHander getAgentRankPageHander;
	
	@Autowired
	private GetAgentRankExportHander getAgentRankExportHander;
	
	@Autowired
	private GetCustomerConversionPageHander getCustomerConversionPageHander;
	
	@Autowired
	private GetCustomerConversionExportHander getCustomerConversionExportHander;
	
	@Autowired
	private GetEffectPageHander getEffectPageHander;
	
	@Autowired
	private GetEffectExportHander getEffectExportHander;
	
	@Autowired
	private GetPremisesCityListHander getPremisesCityListHander;
	
	@Autowired
	private GetPremisesCityGroupListHander getPremisesCityGroupListHander;
	
	@Autowired
	private SendValidateCodeForPwdHander sendValidateCodeForPwdHander;
	
	@Autowired
	private DeletePremisesHander deletePremisesHander;
	
	@Autowired
	private GetPremisesPageHander getPremisesPageHander;
	
	@Autowired
	private GetImportErrorMsgHander getImportErrorMsgHander;
	
	@Autowired
	private GetPremisesGroupByCityHander getPremisesGroupByCityHander;
	
	@Autowired
	private GetHasCPcusListHander getHasCPcusListHander;
	
	@Autowired
	private GetPerCPCommissionListHander getPerCPCommissionListHander;
	
	@Autowired
	private GetCommissionSetPageHander getCommissionSetPageHander;
	
	@Autowired
	private GetPremisesForRuleHander getPremisesForRuleHander;
	
	@Autowired
	private RegistHander registHander;
	
	@Autowired
	private SendVerificationCodeHander sendVerificationCodeHander;
	
	@Autowired
	private AddAppealHander addAppealHander;
	
	@Autowired
	private InitPasswordHander initPasswordHander;
	
	@Autowired
	private GetCommissionModelHander getCommissionModelHander;
	
	@Autowired
	private GetSettlementPageHander getSettlementPageHander;
	
	@Autowired
	private GetAgentPremisesDynamicPageHander getAgentPremisesDynamicPageHander;
	
	@Autowired
	private GetCommissionRuleExportHander getCommissionRuleExportHander;
	
	@Autowired
	private GetPremisesListByCompanyIdHander getPremisesListByCompanyIdHander;
	
	@Autowired
	private GetChooseM2PremisesFlagHander getChooseM2PremisesFlagHander;
	
	@Autowired
	private ChangeDeptHander changeDeptHander;
	
	@Autowired
	private GetDeptByCompCodeHander getDeptByCompCodeHander;
	
	@Autowired
	private MergeDeptHander mergeDeptHander;
	
	
	@Autowired
	private UserChangeDeptHander userChangeDeptHander;
	
	@Autowired
	private GetCompanyByPhoneHander getCompanyByPhoneHander;
	
	@Autowired
	private GetCompanyByAssistantPhoneHander getCompanyByAssistantPhoneHander;
	
	@Autowired
	private IsM2MerchantHander isM2MerchantHander;
	
	@Autowired
	private GetDevPremisesPageHander getDevPremisesPageHander;
	
	@Autowired
	private ImportCooOrgHander importCooOrgHander;
	
	@Autowired
	private BatchAssignPremisesAgentHander batchAssignPremisesAgentHander;
	
	@Autowired
	private GetAgencyIndexSwitchHander getAgencyIndexSwitchHander;
	
	@Autowired
	private ChangeAgencyIndexSwitchHander changeAgencyIndexSwitchHander;
	
	@Autowired
	private GetTimeIntervalHander getTimeIntervalHander;
	
	@Autowired
	private GetPremisesFlowListHander getPremisesFlowListHander;
	
	@Autowired
	private GetPremisesFlowExportHander getPremisesFlowExportHander;
	
	@Autowired
	private BatchAddEstateAdviserHander batchAddEstateAdviserHander;
	
	@Autowired
	private ListEstateAdviserByPremisesIdHandler listEstateAdviserByPremisesIdHandler;
	
	@Autowired
	private AddFirstPaymentHander addFirstPaymentHander;
	
	@Autowired
	private GetFirstPaymentHander getFirstPaymentHander;

	@Autowired
	private GetPremisesCMSmsListHander getPremisesCMSmsListHander;

	@Autowired
	private UpdateCaseMemberHander updateCaseMemberHander;

	@Autowired
	private GetStoreReportPageHander getStoreReportPageHander;

	@Autowired
	private GetGroupReportHander getGroupReportHander;

	@Autowired
	private GetDeptListHander getDeptListHander;

	@Autowired
	private GetAgentReportHander getAgentReportHander;

	@Autowired
	private SmsReportPageHander smsReportPageHander;
	@Autowired
	private SmsReportExportHander smsReportExportHander;

	@Autowired
	private GetOrgAssistantListHander getOrgAssistantListHander;

	@Autowired
    private SetPremisesOrderHander setPremisesOrderHander;

	@Autowired
	private EditReportModelHander editReportModelHander;

	@Autowired
	private DeleteReportModelHander deleteReportModelHander;

	@Autowired
	private GetReportModelListHander getReportModelListHander;
	@Autowired
	private GetReportModelInfoListHander getReportModelInfoListHander;

	@Autowired
	private MoveReportModelOrderHander moveReportModelOrderHander;
	@Autowired
	private ImportCusPreHander importCusPreHander;
	@Autowired
	private AddBatchCusPreHander addBatchCusPreHander;
	@Autowired
	private ExportBatchImpErrorHander exportBatchImpErrorHander;
	@Autowired
	private BatchUpdateReportModelHander batchUpdateReportModelHander;
	@Autowired
	private GetReportModelContentHander getReportModelContentHander;
	@Autowired
    private CheckPremisesNameHander checkPremisesNameHander;
	@Autowired
	private SetMainPushPremisesHander setMainPushPremisesHander;
	@Autowired
	private GetAuthorizeRoleListForDevelopHander getAuthorizeRoleListForDevelopHander;
    @Autowired
    private GetPremisesDynamicHander getPremisesDynamicHander;
    @Autowired
    private PremisesTypeCountHander premisesTypeCountHander;
    @Autowired
    private SelectPremisesImageListHander selectPremisesImageListHander;
    @Autowired
    private EditCustomerInfoHander editCustomerInfoHander;
    @Autowired
    private AddOrEditCustomerInfoHander addOrEditCustomerInfoHander;
    @Autowired
	private GetCompanyInfoHander getCompanyInfoHander;
    @Autowired
    private HouseSalePerformancePageListHander houseSalePerformancePageListHander;
    @Autowired
    private OrganSalePerformancePageListHander organSalePerformancePageListHander;
    @Autowired
    private BossBordHander bossBordHander;
    @Autowired
    private GetAreaAndPremisesCountHander getAreaAndPremisesCountHander;
    @Autowired
    private GetParentDeptHander getParentDeptHander;
    @Autowired
	private GetWxMsgModelHander getWxMsgModelHander;
    @Autowired
	private ReuseSmsSettingHander reuseSmsSettingHander;
    @Autowired
	private ChangeWeixinModelSettingHander changeWeixinModelSettingHander;
    @Autowired
	private SendFailureWxmsgAgainHander sendFailureWxmsgAgainHander;
    @Autowired
	private OverdueDecisionConfigHander overdueDecisionConfigHander;
    @Autowired
	private GetOverdueConfigInfoHander getOverdueConfigInfoHander;
    @Autowired
    private GetM2ProjectsHander getM2ProjectsHander;
    @Autowired
    private CheckReportProtectHander checkReportProtectHander;
	@Autowired
	private RedisOperateHander redisOperateHander;

	@Autowired
	private AddPremisesRecommenderHander addPremisesRecommenderHander;

	@Autowired
    private PremisesRecommenderInfoHander premisesRecommenderInfoHander;

	@Autowired
    private PremisesRecommenderListHander premisesRecommenderListHander;

	@Autowired
	private EstateAdviserListHander estateAdviserListHander;

	@Autowired
	private EditEstateAdviserHander editEstateAdviserHander;

	@Autowired
	private ChangeCPAdviserHander changeCPAdviserHander;

	@Autowired
	private GetCPCountByAdviserHander getCPCountByAdviserHander;

	@Autowired
	private PremisesRecommenderAllListHander premisesRecommenderAllListHander;

	@Autowired
	private BatchAddPremisesRecommenderHander batchAddPremisesRecommenderHander;

	@Autowired
	private DelPremisesRecommenderHander delPremisesRecommenderHander;

	@Autowired
	private RecommenderChangeHander recommenderChangeHander;

	@Autowired
	private GetTradeStatusChangeHander getTradeStatusChangeHander;

	@Autowired
	private AgentRegisterSwitchHander agentRegisterSwitchHander;

	@Autowired
	private GetReportRecommendHander getReportRecommendHander;

	@Autowired
	private GetAgentListHander getAgentListHander;

	@Autowired
	private GetPartnerInfoByDeptHander getPartnerInfoByDeptHander;

	@Autowired
	private GetRecommenderListHander getRecommenderListHander;

	@Autowired
	private GetPremisesListByStatusHander getPremisesListByStatusHander;

	@Autowired
	private ExportReportRecommendHander exportReportRecommendHander;

	@Autowired
	private GetAgentPremisesListHander getAgentPremisesListHander;

	@Autowired
	private GetVisitStateListHander getVisitStateListHander;

	@Autowired
	private AdminTransferHander adminTransferHander;
	
	@Autowired
	private UpdateAccountTypeHander updateAccountTypeHander;
	
	@Autowired
	private CheckReportListHander checkReportListHander;

	@Autowired
	private AddBatchReportHander addBatchReportHander;

	@Autowired
	private SendMobileCheckCodeHander sendMobileCheckCodeHander;

	@Autowired
	private CheckMobileCheckCodeHander checkMobileCheckCodeHander;

	@Autowired
	private EditReportCommissionHander editReportCommissionHander;

	@Autowired
	private DealReportCommissionHander dealReportCommissionHander;

	@Autowired
	private GetReportCommissionLogListHander getReportCommissionLogListHander;

	@Autowired
	private GetAgentCommissionSummaryHander getAgentCommissionSummaryHander;

	@Autowired
	private GetAgentCommissionSummaryPageHander getAgentCommissionSummaryPageHander;

	@Autowired
	private  GetAgentCustomerPremisesCommissionPageHander getAgentCustomerPremisesCommissionPageHander;

	@Autowired
	private UpdateDueRemainderHander updateDueRemainderHander;
	
	@Autowired
	private GetPremisesAndCaseMemberByStaffIdHandler getPremisesAndCaseMemberByStaffIdHandler;
	
	@Autowired
	private BatchUpdateCaseMemberHandler batchUpdateCaseMember;
	
	@Autowired
	private BatchUpdateCaseMemberPremisesHandler batchUpdateCaseMemberPremisesHandler;

	@Autowired
	private AddPremisesDefendHander addPremisesDefendHander;
	
	@Autowired
	private GetQiniuUploadTokenHander getQiniuUploadTokenHander;
	
	@Autowired
	private UpdateCompanyAbbreviationHander updateCompanyAbbreviationHander;
	
	@Autowired
	private GetAgentInfoHander getAgentInfoHander;
	
	@Autowired
	private GetAgentRuleHander getAgentRuleHander;
	
	@Autowired
	private SavePartnerCheckRuleHander savePartnerCheckRuleHander;
	
	@Autowired
	private SaveModelHander saveModelHander;
	
	@Autowired
	private GetCheckListHander getCheckListHander;
	
	@Autowired
	private MyService myService;
	
	@Autowired
	private PartnerCheckHander partnerCheckHander;
	
	@Autowired
	GetLevelDeptTreeHander getLevelDeptTreeHander;
	
	@Autowired
	SaveAgentCompanyRegesitHander saveAgentCompanyRegesitHander;
	
	@Autowired
	GetAgentCompanyRegesitListHander getAgentCompanyRegesitListHander;
	
	@Autowired
	UpdateCompanyCredentialHander updateCompanyCredentialHander;
	
	@Autowired
	AgentCompanyCheckHander agentCompanyCheckHander;
	
	@Autowired
	GetModelByNameHander getModelByNameHander;
	

	@ApiOperation(value = "机构佣金信息汇总")
	@PostMapping(value = "/cp/getAgentCommissionSummary", produces = "application/json")
	public String getAgentCommissionSummary(HttpServletRequest request, @RequestBody GetAgentCommissionSummaryReqVo reqVo){
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentCommissionSummaryHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("EditReportCommissionReqVo error: {}", e);
			return null;
		}
	}

	@ApiOperation(value = "机构佣金信息列表")
	@PostMapping(value = "/cp/getAgentCommissionSummaryPage", produces = "application/json")
	public String getAgentCommissionSummaryPage(HttpServletRequest request, @RequestBody GetAgentCommissionSummaryPageReqVo reqVo){
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentCommissionSummaryPageHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("EditReportCommissionReqVo error: {}", e);
			return null;
		}
	}

	@ApiOperation(value = "机构楼盘佣金信息列表")
	@PostMapping(value = "/cp/getAgentCustomerPremisesCommissionPage", produces = "application/json")
	public String getAgentCustomerPremisesCommissionPage(HttpServletRequest request, @RequestBody GetAgentCustomerPremisesCommissionPageReqVo reqVo){
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentCustomerPremisesCommissionPageHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("EditReportCommissionReqVo error: {}", e);
			return null;
		}
	}

	@ApiOperation(value = "新增/编辑佣金信息")
	@PostMapping(value = "/cp/editReportCommission", produces = "application/json")
	public String editReportCommission(HttpServletRequest request, @RequestBody EditReportCommissionReqVo reqVo){
		try {
			return JSONUtil.toJSONStringWithDateFormat(editReportCommissionHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("EditReportCommissionReqVo error: {}", e);
			return null;
		}
	}

	@ApiOperation(value = "结算佣金信息")
	@PostMapping(value = "/cp/dealReportCommission", produces = "application/json")
	public String dealReportCommission(HttpServletRequest request, @RequestBody DealReportCommissionReqVo reqVo){
		try {
			return JSONUtil.toJSONStringWithDateFormat(dealReportCommissionHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("EditReportCommissionReqVo error: {}", e);
			return null;
		}
	}

	@ApiOperation(value = "获取佣金历史信息")
	@PostMapping(value = "/cp/getReportCommissionLog", produces = "application/json")
	public String getReportCommissionLog(HttpServletRequest request, @RequestBody GetReportCommissionLogListReqVo reqVo){
		try {
			return JSONUtil.toJSONStringWithDateFormat(getReportCommissionLogListHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("EditReportCommissionReqVo error: {}", e);
			return null;
		}
	}

	@Domain
	@PostMapping(value = "/getLogo", produces = "application/json")
	public String getLogo(HttpServletRequest request, @RequestBody GetLogoReqVo getLogoReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getLogoHander.hander(getLogoReqVo));
		} catch (Exception e) {
			logger.error("getLogo error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/login", produces = "application/json")
	public String login(HttpServletRequest request, @RequestBody LoginReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(loginHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("login error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/loginOut", produces = "application/json")
	public String loginOut(HttpServletRequest request, @RequestBody LoginOutReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(loginOutHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("loginOut error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getMenu", produces = "application/json")
	public String getMenu(HttpServletRequest request, @RequestBody GetMenuReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getMenuHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getMenu error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getUserAuthList", produces = "application/json")
	public String getUserAuthList(HttpServletRequest request, @RequestBody GetUserAuthListReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getUserAuthListHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getUserAuthList error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getAssistantAppIndex", produces = "application/json")
	public String getAssistantAppIndex(HttpServletRequest request, @RequestBody GetAssistantAppIndexReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAssistantAppIndexHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getAssistantAppIndex error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getCPStatisticsByPremises", produces = "application/json")
	public String getCPStatisticsByPremises(HttpServletRequest request, @RequestBody GetCPStatisticsByPremisesReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCPStatisticsByPremisesHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getCPStatisticsByPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * 分销PC首页信息
	 *
	 * @return
	 */
	@PostMapping(value = "/getAgencyPcIndex", produces = "application/json")
	public String getAgencyPcIndex(@RequestBody GetAgencyPCIndexReqVo getAgencyPCIndexReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgencyPcIndexHander.hander(getAgencyPCIndexReqVo));
		} catch (Exception e) {
			logger.error("getAgencyPcIndex error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取用户操作权限
	 *
	 * @return
	 */
	@PostMapping(value = "/getOptAuth", produces = "application/json")
	public String getOptAuth(@RequestBody GetOptAuthReqVo getOptAuthReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getOptAuthHander.hander(getOptAuthReqVo));
		} catch (Exception e) {
			logger.error("getOptAuth error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取省份列表
	 *
	 * @param getProvinceReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getProvince", produces = "application/json")
	public String getProvince(HttpServletRequest request, @RequestBody GetProvinceReqVo getProvinceReqVo) {
		try {

			return JSONUtil.toJSONStringWithDateFormat(getProvinceHander.hander(getProvinceReqVo));
		} catch (Exception e) {
			logger.error("getProvince error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取城市列表
	 *
	 * @param getCityReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getCity", produces = "application/json")
	public String getCity(HttpServletRequest request, @RequestBody GetCityReqVo getCityReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCityHander.hander(getCityReqVo));
		} catch (Exception e) {
			logger.error("getCity error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取市区列表
	 *
	 * @param getAreaReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getArea", produces = "application/json")
	public String getArea(HttpServletRequest request, @RequestBody GetAreaReqVo getAreaReqVo) {
		try {

			return JSONUtil.toJSONStringWithDateFormat(getAreaHander.hander(getAreaReqVo));
		} catch (Exception e) {
			logger.error("getArea error: {}", e);
		}
		return null;
	}
	
	/**
	 * 上传图片
	 *
	 * @param mulRequest
	 * @return
	 * @throws IOException
	 */
	@PostMapping(value = "/uploadBase64", produces = "application/json")
	public String uploadBase64(MultipartHttpServletRequest mulRequest) {
		BaseResponseDTO<UploadBase64ResDto> res = new BaseResponseDTO<>();
		UploadBase64ResDto resDto = new UploadBase64ResDto();
		try {
			Iterator<String> fileNames = mulRequest.getFileNames();
			byte[] imgByte = null;
			// 遍历请求中的图片信息
			if (fileNames.hasNext()) {
				// 图片对应的参数名
				String fileName = fileNames.next();
				// 获取到图片
				MultipartFile file = mulRequest.getFile(fileName);
				if (file != null) {
					logger.info("upload file,file set {}", fileConfig.getFileSet());
					String result = HttpApi.doPostForFile(file,fileConfig.getFileSet());
					logger.info("upload file,result {}", result);
					if(result != null ){
						return result;
					}
					// 可以获取到图片的字节数组
					imgByte = file.getBytes();
				}
			}
			/**
			for (int i = 0; i < imgByte.length; ++i) {
				if (imgByte[i] < 0) {
					// 调整异常数据
					imgByte[i] += 256;
				}
			}
			//获取当前日期
			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
			String date = sdf.format(System.currentTimeMillis());
			// 获取图片保存路径
			String imgFilePath = fileConfig.getFileSet() + "/default/" + date;
			// 创建图片文件夹（文件夹名格式  yyyyMMdd ）
			FileUtils.fileIsMkdirs(imgFilePath);
			// 图片名称
			String imgName = "/" + String.valueOf(System.currentTimeMillis()) + ".png";
			OutputStream out = new FileOutputStream(imgFilePath + imgName);
			out.write(imgByte);
			out.flush();
			out.close();
			
			// 获取图片访问路径
			String getImgFilePath = fileConfig.getFileGet() + "/default/" + date;
			resDto.setImgName(getImgFilePath + imgName);
			res.setResult(ResultEnum.SUCCESS.getNo());
			res.setResData(resDto);
			 **/
		} catch (Exception e) {
			logger.error("上传图片失败: {}", e);
			res.setResult(ResultEnum.FAIL.getNo());
			res.setErrorMsg("上传图片失败");
		}
		return JSONUtil.toJSONStringWithDateFormat(res);
	}
	
	/**
	 * 上传文件到七牛
	 * 指定suffix可上传对应后缀的文件，不指定suffix默认为上传图片类型
	 * @param mulRequest
	 * @return
	 * @throws IOException
	 */
	@PostMapping(value = "/uploadBase64ToQiNiu", produces = "application/json")
	@ApiOperation(value="上传文件到七牛云，默认上传图片，指定suffix可上传其它类型的文件。")
	public String uploadBase64ToQiNiu(MultipartHttpServletRequest mulRequest) {
		
		BaseResponseDTO<UploadBase64ResDto> res = new BaseResponseDTO<>();
		
		UploadBase64ResDto resDto = new UploadBase64ResDto();
		
		try {
			Iterator<String> fileNames = mulRequest.getFileNames();
		
			byte[] fileBytes = null;
			
			String suffix = null;
			//获取上传的第一个文件
			if (fileNames.hasNext()) {
				//文件参数名
				String fileName = fileNames.next();
				//获取到文件
				MultipartFile file = mulRequest.getFile(fileName);
				//文件后缀名
				suffix = mulRequest.getParameter("suffix");
				
				if (file == null) {
					throw new ChannelException("upload file is null.");
				}
				//获取到文件的字节数组
				fileBytes = file.getBytes();
				
				if(suffix==null&&file.getContentType().startsWith("image/")) {

					suffix=file.getContentType().replace("image/", ".");
				}
			}
			
			if(fileBytes==null) {
				throw new ChannelException("get file bytes array faild.");
			}
			
			for (int i = 0; i < fileBytes.length; ++i) {
			
				if (fileBytes[i] < 0) {
					// 调整异常数据
					fileBytes[i] += 256;
				}
			}

			if(suffix==null) {
				
				throw new ChannelException("upload file 's suffix is null.");
			}
			
			String fileKey = QiNiuUtil.getFileKey(suffix);

			//将文件存储到七牛云
			String upload = QiNiuUtil.upload(fileBytes,fileKey, QiNiuUtil.STORE_BUCKET);
			
			logger.info("upload result : {}",upload);
			
			resDto.setImgName(QiNiuUtil.FILE_VIEWURL+fileKey);
			
			res.setResult(ResultEnum.SUCCESS.getNo());

			res.setResData(resDto);
			
		} catch (Exception e) {
			
			logger.error("上传文件失败: {}", e);
			
			res.setResult(ResultEnum.FAIL.getNo());
			
			res.setErrorMsg("上传文件失败");
		}
		
		return JSONUtil.toJSONStringWithDateFormat(res);
	
	}
	
	/**
	 * 获取图片
	 *
	 * @param getFilesReqVo
	 * @return
	 */
	@PostMapping(value = "/getFiles", produces = "application/json")
	public String getFiles(@RequestBody GetFilesReqVo getFilesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getFilesHander.hander(getFilesReqVo));
		} catch (Exception e) {
			logger.error("getFiles error: {}", e);
		}
		return null;
	}
	
	/**
	 * （2） 驻守楼盘列表
	 *
	 * @param request
	 * @param getCaseMemberListReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getCaseMemberList", produces = "application/json")
	public String getCaseMemberList(HttpServletRequest request, @RequestBody GetCaseMemberListReqVo getCaseMemberListReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getCaseMemberListReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getCaseMemberListHander.hander(getCaseMemberListReqVo));
		} catch (Exception e) {
			logger.error("getCaseMemberList error: {}", e);
			return null;
		}
	}
	
	/**
	 * 获取楼盘驻守人员及驻守人员驻守的其他楼盘信息
	 *
	 * @param request
	 * @param getPremisesCMListReqVo
	 * @return
	 */
	@PostMapping(value = "/getPremisesCMList", produces = "application/json")
	public String getPremisesCMList(HttpServletRequest request, @RequestBody GetPremisesCMListReqVo getPremisesCMListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPremisesCMListHander.hander(getPremisesCMListReqVo));
		} catch (Exception e) {
			logger.error("getPremisesCMList error: {}", e);
			return null;
		}
	}
	
	/**
	 * 解绑经纪人驻守楼盘
	 *
	 * @param request
	 * @param unbindPartnerToPremisesReqVo
	 * @return
	 */
	@PostMapping(value = "/unbindPartnerToPremises", produces = "application/json")
	@ForbidRepeatClick
	public String unbindPartnerToPremises(HttpServletRequest request, @RequestBody UnbindPartnerToPremisesReqVo unbindPartnerToPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(unbindPartnerToPremisesHander.hander(unbindPartnerToPremisesReqVo));
		} catch (Exception e) {
			logger.error("unbindPartnerToPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * （3） 获取项目
	 *
	 * @param request
	 * @param getPremisesListReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesList", produces = "application/json")
	public String getPremisesList(HttpServletRequest request, @RequestBody GetPremisesListReqVo getPremisesListReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesListReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesListHander.hander(getPremisesListReqVo));
		} catch (Exception e) {
			logger.error("getPremisesList error: {}", e);
			return null;
		}
	}
	
	/**
	 * （4） 楼盘列表
	 *
	 * @param request
	 * @param findPremisesListReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getAgentPremisesPage", produces = "application/json")
	public String getAgentPremisesPage(HttpServletRequest request, @RequestBody GetAgentPremisesPageReqVo findPremisesListReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			findPremisesListReqVo.getParams().setDomain(domain);
//			findPremisesListReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(getAgentPremisesPageHander.hander(findPremisesListReqVo));
		} catch (Exception e) {
			logger.error("getAgentPremisesPage error: {}", e);
			return null;
		}
	}
	
	/**
	 * （5） 获取存在规则的项目
	 *
	 * @param request
	 * @param getPremisesWithCRReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesWithCR", produces = "application/json")
	public String getPremisesWithCR(HttpServletRequest request, @RequestBody GetPremisesWithCRReqVo getPremisesWithCRReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesWithCRReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesWithCRHander.hander(getPremisesWithCRReqVo));
		} catch (Exception e) {
			logger.error("getPremisesWithCR error: {}", e);
			return null;
		}
	}
	
	/**
	 * （6） 驻守楼盘分页
	 *
	 * @param request
	 * @param getCaseMemberPageReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getCaseMemberPage", produces = "application/json")
	public String getCaseMemberPage(HttpServletRequest request, @RequestBody GetCaseMemberPageReqVo getCaseMemberPageReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getCaseMemberPageReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getCaseMemberPageHander.hander(getCaseMemberPageReqVo));
		} catch (Exception e) {
			logger.error("getCaseMemberPage error: {}", e);
			return null;
		}
	}
	
	/**
	 * （8） 经纪人已驻守楼盘
	 *
	 * @param request
	 * @param getPartnerBindPremisesReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getBindPremises", produces = "application/json")
	public String getBindPremises(HttpServletRequest request, @RequestBody GetPartnerBindPremisesReqVo getPartnerBindPremisesReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPartnerBindPremisesReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getBindPremisesHander.hander(getPartnerBindPremisesReqVo));
		} catch (Exception e) {
			logger.error("getBindPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * （9） 经纪人未驻守楼盘
	 *
	 * @param request
	 * @param getPartnerBindPremisesReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPartnerUnBindPremises", produces = "application/json")
	public String getPartnerUnBindPremises(HttpServletRequest request, @RequestBody GetPartnerBindPremisesReqVo getPartnerBindPremisesReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPartnerBindPremisesReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPartnerUnBindPremisesHander.hander(getPartnerBindPremisesReqVo));
		} catch (Exception e) {
			logger.error("getPartnerUnBindPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * （10） 经纪人驻守楼盘
	 *
	 * @param request
	 * @param bindPartnerToPremisesReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/bindPartnerToPremises", produces = "application/json")
	public String bindPartnerToPremises(HttpServletRequest request, @RequestBody BindPartnerToPremisesReqVo bindPartnerToPremisesReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			bindPartnerToPremisesReqVo.getParams().setDomain(domain);
//			bindPartnerToPremisesReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(bindPartnerToPremisesHander.hander(bindPartnerToPremisesReqVo));
		} catch (Exception e) {
			logger.error("bindPartnerToPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * （11） 新增楼盘
	 *
	 * @param request
	 * @param addOrEditPremisesReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/addPremises", produces = "application/json")
	public String addPremises(HttpServletRequest request, @RequestBody AddOrEditPremisesReqVo addOrEditPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addPremisesHander.hander(addOrEditPremisesReqVo));
		} catch (Exception e) {
			logger.error("addPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * （12） 楼盘修改
	 *
	 * @param request
	 * @param addOrEditPremisesReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/editPremises", produces = "application/json")
	public String editPremises(HttpServletRequest request, @RequestBody AddOrEditPremisesReqVo addOrEditPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(editPremisesHander.hander(addOrEditPremisesReqVo));
		} catch (Exception e) {
			logger.error("editPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * （13） 楼盘审核
	 *
	 * @param request
	 * @return
	 */
	@Domain
	@PostMapping(value = "/auditPremises", produces = "application/json")
	@ForbidRepeatClick
	public String auditPremises(HttpServletRequest request, @RequestBody AuditPremisesReqVo auditPremisesReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			auditPremisesReqVo.getParams().setDomain(domain);
//			auditPremisesReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(auditPremisesHander.hander(auditPremisesReqVo));
		} catch (Exception e) {
			logger.error("auditPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * （13） 楼盘上下架
	 *
	 * @param request
	 * @return
	 */
	@Domain
	@PostMapping(value = "/changeShelvesStatus", produces = "application/json")
	public String changeShelvesStatus(HttpServletRequest request, @RequestBody ChangeShelvesStatusReqVo changeShelvesStatusReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			changeShelvesStatusReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(changeShelvesStatusHander.hander(changeShelvesStatusReqVo));
		} catch (Exception e) {
			logger.error("changeShelvesStatus error: {}", e);
			return null;
		}
	}
	
	/**
	 * （14） 楼盘交易状态变更
	 *
	 * @param request
	 * @return
	 */
	@Domain
	@PostMapping(value = "/changePremisesSaleStatus", produces = "application/json")
	public String changePremisesSaleStatus(HttpServletRequest request, @RequestBody ChangePremisesSaleStatusReqVo changePremisesSaleStatusReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			changePremisesSaleStatusReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(changePremisesSaleStatusHander.hander(changePremisesSaleStatusReqVo));
		} catch (Exception e) {
			logger.error("changePremisesSaleStatus error: {}", e);
			return null;
		}
	}
	
	/**
	 * （15） 楼盘指定分销商
	 *
	 * @param request
	 * @param assignPremisesAgentReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/assignPremisesAgent", produces = "application/json")
	public String assignPremisesAgent(HttpServletRequest request, @RequestBody AssignPremisesAgentReqVo assignPremisesAgentReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			assignPremisesAgentReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(assignPremisesAgentHander.hander(assignPremisesAgentReqVo));
		} catch (Exception e) {
			logger.error("assignPremisesAgent error: {}", e);
			return null;
		}
	}
	
	/**
	 * （16） 楼盘详情
	 *
	 * @param request
	 * @param getPremisesDetailReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesDetail", produces = "application/json")
	public String getPremisesDetail(HttpServletRequest request, @RequestBody GetPremisesDetailReqVo getPremisesDetailReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesDetailReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesDetailHander.hander(getPremisesDetailReqVo));
		} catch (Exception e) {
			logger.error("getPremisesDetail error: {}", e);
			return null;
		}
	}
	
	/**
	 * （18） 楼盘是否有效
	 *
	 * @param request
	 * @param checkPremisesValidReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/checkPremisesValid", produces = "application/json")
	public String checkPremisesValid(HttpServletRequest request, @RequestBody CheckPremisesValidReqVo checkPremisesValidReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			checkPremisesValidReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(checkPremisesValidHander.hander(checkPremisesValidReqVo));
		} catch (Exception e) {
			logger.error("checkPremisesValid error: {}", e);
			return null;
		}
	}
	
	/**
	 * （19） 楼盘动态Page
	 *
	 * @param request
	 * @param getPremisesDynamicPageReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesDynamicPage", produces = "application/json")
	public String getPremisesDynamicPage(HttpServletRequest request, @RequestBody GetPremisesDynamicPageReqVo getPremisesDynamicPageReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesDynamicPageReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesDynamicPageHander.hander(getPremisesDynamicPageReqVo));
		} catch (Exception e) {
			logger.error("getPremisesDynamicPage error: {}", e);
			return null;
		}
	}
	
	/**
	 * （21） 楼盘动态新增
	 *
	 * @param request
	 * @return
	 */
	@Domain
	@PostMapping(value = "/addPremisesDynamic", produces = "application/json")
	public String addPremisesDynamic(HttpServletRequest request, @RequestBody AddOrEditPremisesDynamicReqVo addPremisesDynamicReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			addPremisesDynamicReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(addPremisesDynamicHander.hander(addPremisesDynamicReqVo));
		} catch (Exception e) {
			logger.error("addPremisesDynamic error: {}", e);
			return null;
		}
	}
	
	/**
	 * （22） 楼盘动态修改
	 *
	 * @param request
	 * @param addOrEditPremisesDynamicReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/editPremisesDynamic", produces = "application/json")
	public String editPremisesDynamic(HttpServletRequest request, @RequestBody AddOrEditPremisesDynamicReqVo addOrEditPremisesDynamicReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			addOrEditPremisesDynamicReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(editPremisesDynamicHander.hander(addOrEditPremisesDynamicReqVo));
		} catch (Exception e) {
			logger.error("editPremisesDynamic error: {}", e);
			return null;
		}
	}
	
	/**
	 * （23） 楼盘动态详情
	 *
	 * @param request
	 * @param getPremisesDynamicDetailReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesDynamicDetail", produces = "application/json")
	public String getPremisesDynamicDetail(HttpServletRequest request, @RequestBody GetPremisesDynamicDetailReqVo getPremisesDynamicDetailReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesDynamicDetailReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesDynamicDetailHander.hander(getPremisesDynamicDetailReqVo));
		} catch (Exception e) {
			logger.error("getPremisesDynamicDetail error: {}", e);
			return null;
		}
	}
	
	/**
	 * （25） 楼盘户型图
	 *
	 * @param request
	 * @param getPremisesHxtReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesHxt", produces = "application/json")
	public String getPremisesHxt(HttpServletRequest request, @RequestBody GetPremisesHxtReqVo getPremisesHxtReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesHxtReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesHxtHander.hander(getPremisesHxtReqVo));
		} catch (Exception e) {
			logger.error("getPremisesHxt error: {}", e);
			return null;
		}
	}
	
	@Deprecated
	@GetMapping(value = "/exportCP", produces = "application/json")
	public String exportCP(HttpServletRequest request, HttpServletResponse response,  ExportCPReqVo reqVo)
		throws IOException {
		try {
			BaseResponseDTO<ExportCPResDto> resDto = exportCPHander.hander(reqVo);
			ExportCPResDto exportCPResDto = resDto.getResData();
			
			List<String[]> headerList = exportCPResDto.getHeaderList();
			List<List<Map<String, String>>> customerList = exportCPResDto.getCustomerList();
			if (null != customerList && customerList.size() > 0) {
				// 组装excel
				String[] exportName = new String[] {"合作机构信息"};
				Export.exportCustomerReportExcel("报备列表", exportCPResDto.getCustomerList(), headerList, exportName, response);
			}
			BaseResponseDTO<ExportCPResDto> returnResDto = new BaseResponseDTO<ExportCPResDto>();
			returnResDto.setResult(resDto.getResult());
			return JSONUtil.toJSONStringWithDateFormat(returnResDto);
		} catch (Exception e) {
			logger.error("exportCP error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getCPPage", produces = "application/json")
	public BaseResponseDTO<GetCPPageResDto> getCPPage(HttpServletRequest request, @RequestBody GetCPPageReqVo reqVo) {

		return (BaseResponseDTO<GetCPPageResDto>)getCPPageHander.hander(reqVo);
	}

    @PostMapping(value = "/getAssistantReportPage", produces = "application/json")
    public BaseResponseDTO<AssistantReportPageResDto> getAssistantReportPage(HttpServletRequest request, @RequestBody AssistantReportPageReqVo reqVo) {
        return (BaseResponseDTO<AssistantReportPageResDto>)getAssistantReportPageHander.hander(reqVo);
    }

    @PostMapping(value = "/getAssistantAppReportPage", produces = "application/json")
    public BaseResponseDTO<GetCPPageResDto> getAssistantAppReportPage(HttpServletRequest request, @RequestBody AssistantReportPageReqVo reqVo) {
        return (BaseResponseDTO<GetCPPageResDto>)getAssistantAppReportPageHander.hander(reqVo);
    }
	
	@PostMapping(value = "/getCPAppealPage", produces = "application/json")
	public String getCPAppealPage(HttpServletRequest request, @RequestBody GetCPAppealPageReqVo reqVo) {
        return JSONUtil.toJSONStringWithDateFormat(getCPAppealPageHander.hander(reqVo));
	}

	@Domain
	@PostMapping(value = "/agencyReport", produces = "application/json")
	@ForbidRepeatClick
	public String agencyReport(HttpServletRequest request, @RequestBody AgencyReportReqVo reqVo) {
        return JSONUtil.toJSONStringWithDateFormat(agencyReportHander.hander(reqVo));
	}

	@Domain
	@PostMapping(value = "/reportAgain", produces = "application/json")
	public String reportAgain(HttpServletRequest request, @RequestBody ReportAgainReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(reportAgainHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("reportAgain error: {}", e);
			return null;
		}
	}

	@Domain
	@ForbidRepeatClick
	@PostMapping(value = "/addReport", produces = "application/json")
	public String addReport(HttpServletRequest request, @RequestBody AddReportReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addReportHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("addReport error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/completePhone", produces = "application/json")
	public String completePhone(HttpServletRequest request, @RequestBody CompletePhoneReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(completePhoneHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("completePhone error: {}", e);
			return null;
		}
	}

	@SuppressWarnings("unchecked")
	@Domain
	@PostMapping(value = "/auditCP")
	public BaseResponseDTO<AuditCPResDto> auditCP(HttpServletRequest request, @RequestBody AuditCPReqVo reqVo){
        String originUrl = request.getHeader(ApiConstant.ORIGIN);
        reqVo.getParams().setOriginUrl(originUrl);
		return (BaseResponseDTO<AuditCPResDto>) auditCPHander.hander(reqVo);
	}

	@Domain
	@PostMapping(value = "/resetAudit")
	public BaseResponseDTO<ResetAuditResDto> resetAudit(HttpServletRequest request, @RequestBody ResetAuditReqVo reqVo){
		String originUrl = request.getHeader(ApiConstant.ORIGIN);
		reqVo.getParams().setOriginUrl(originUrl);
		return (BaseResponseDTO<ResetAuditResDto>) resetAuditHander.hander(reqVo);
	}

	@Domain
	@PostMapping(value = "/auditCPAppeal", produces = "application/json")
	public String auditCPAppeal(HttpServletRequest request, @RequestBody AuditCPAppealReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(auditCPAppealHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("auditCPAppeal error: {}", e);
			return null;
		}
	}

	@SuppressWarnings("unchecked")
	@Domain
	@PostMapping(value = "/changeCPConfirm")
	public BaseResponseDTO<ChangeCPConfirmResDto> changeCPConfirm(HttpServletRequest request, @RequestBody ChangeCPConfirmReqVo reqVo){
	    String originUrl = request.getHeader(ApiConstant.ORIGIN);
	    reqVo.getParams().setOriginUrl(originUrl);
		return (BaseResponseDTO<ChangeCPConfirmResDto>)changeCPConfirmHander.hander(reqVo);
	}

	@Domain
	@PostMapping(value = "/resetConfirm")
	public BaseResponseDTO<ResetConfirmResDto> resetAudit(HttpServletRequest request, @RequestBody ResetConfirmReqVo reqVo){
		String originUrl = request.getHeader(ApiConstant.ORIGIN);
		reqVo.getParams().setOriginUrl(originUrl);
		return (BaseResponseDTO<ResetConfirmResDto>) resetConfirmHander.hander(reqVo);
	}
	
	@PostMapping(value = "/changeCPMortgage", produces = "application/json")
	public String changeCPMortgage(HttpServletRequest request, @RequestBody ChangeCPMortgageReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(changeCPMortgageHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("changeCPMortgage error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/distCPAgent", produces = "application/json")
	public String distCPAgent(HttpServletRequest request, @RequestBody DistCPAgentReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(distCPAgentHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("distCPAgent error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/editCPCusInfo", produces = "application/json")
	public String editCPCusInfo(HttpServletRequest request, @RequestBody EditCPCusInfoReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(editCPCusInfoHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("editCPCusInfo error: {}", e);
			return null;
		}
	}
	
	
	
	@PostMapping(value = "/getCPDetail", produces = "application/json")
	public String getCPDetail(HttpServletRequest request, @RequestBody GetCPDetailReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCPDetailHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getCPDetail error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getCPFollowList", produces = "application/json")
	public String getCPFollowList(HttpServletRequest request, HttpServletResponse response, @RequestBody GetCPFollowListReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCPFollowListHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getCPFollowList error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getCPFollowStatusList", produces = "application/json")
	public String getCPFollowStatusList(HttpServletRequest request, HttpServletResponse response, @RequestBody GetCPFollowStatusListReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCPFollowStatusListHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getCPFollowStatusList error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/addFollow", produces = "application/json")
    @Domain
	public String addFollow(HttpServletRequest request, HttpServletResponse response, @RequestBody AddFollowReqVo reqVo)
		throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addFollowHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("addFollow error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/isInSpecialTime", produces = "application/json")
	public String isInSpecialTime(HttpServletRequest request, HttpServletResponse response, @RequestBody IsInSpecialTimeReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(isInSpecialTimeHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("isInSpecialTime error: {}", e);
			return null;
		}
	}
	
	/**
	 * （2） 生成微信二维码
	 *
	 * @param request
	 * @param createQRCodeReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/createQRCode", produces = "application/json")
	public String createQRCode(HttpServletRequest request, @RequestBody CreateQRCodeReqVo createQRCodeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(createQRCodeHander.hander(createQRCodeReqVo));
		} catch (Exception e) {
			logger.error("createQRCode error: {}", e);
			return null;
		}
	}
	
	/**
	 * （3） 获取微信授权码
	 *
	 * @param request
	 * @return
	 */
	@Domain
	@PostMapping(value = "/js_ticket", produces = "application/json")
	public String jsTicket(HttpServletRequest request, @RequestBody GetWeiXinJsTicketReqVo getWeiXinJsTicketReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getWeiXinJsTicketHander.hander(getWeiXinJsTicketReqVo));
		} catch (Exception e) {
			logger.error("js_ticket error: {}", e);
			return null;
		}
	}
	
	/**
	 * （4） 获取转客信息
	 *
	 * @param request
	 * @param getCPToM2InfoReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getCPToM2Info", produces = "application/json")
	public String getCPToM2Info(HttpServletRequest request, @RequestBody GetCPToM2InfoReqVo getCPToM2InfoReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCPToM2InfoHander.hander(getCPToM2InfoReqVo));
		} catch (Exception e) {
			logger.error("getCPToM2Info error: {}", e);
			return null;
		}
	}
	
	/**
	 * （5） 获取M2楼盘
	 *
	 * @param request
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesByM2", produces = "application/json")
	public String getPremisesByM2(HttpServletRequest request, @RequestBody GetPremisesByM2ReqVo getPremisesByM2ReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPremisesByM2Hander.hander(getPremisesByM2ReqVo));
		} catch (Exception e) {
			logger.error("getPremisesByM2 error: {}", e);
			return null;
		}
	}
	
	/**
	 * （6） 转客
	 *
	 * @param request
	 * @param customerToM2ReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/customerToM2", produces = "application/json")
	public String customerToM2(HttpServletRequest request, @RequestBody CustomerToM2ReqVo customerToM2ReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(customerToM2Hander.hander(customerToM2ReqVo));
		} catch (Exception e) {
			logger.error("customerToM2 error: {}", e);
			return null;
		}
	}
	
	/**
	 * 获取字典类型表
	 *
	 * @param getBaseCodeTypeReqVo
	 * @return
	 */
	@PostMapping(value = "/getBaseCodeType", produces = "application/json")
	public String getBaseCodeType(@RequestBody GetBaseCodeTypeReqVo getBaseCodeTypeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getBaseCodeTypeHander.hander(getBaseCodeTypeReqVo));
		} catch (Exception e) {
			logger.error("getBaseCodeType error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取字典类型tree
	 *
	 * @param getBaseCodeTypeTreeReqVo
	 * @return
	 */
	@PostMapping(value = "/getBaseCodeTypeTree", produces = "application/json")
	public String getBaseCodeTypeTree(@RequestBody GetBaseCodeTypeTreeReqVo getBaseCodeTypeTreeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getBaseCodeTypeTreeHander.hander(getBaseCodeTypeTreeReqVo));
		} catch (Exception e) {
			logger.error("getBaseCodeTypeTree error: {}", e);
		}
		return null;
	}
	
	/**
	 * 新增标签
	 *
	 * @param addBaseCodeTypeReqVo
	 * @return
	 */
	@PostMapping(value = "/addBaseCodeType", produces = "application/json")
	public String addBaseCodeType(@RequestBody AddBaseCodeTypeReqVo addBaseCodeTypeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addBaseCodeTypeHander.hander(addBaseCodeTypeReqVo));
		} catch (Exception e) {
			logger.error("addBaseCodeType error: {}", e);
		}
		return null;
	}
	
	/**
	 * 修改标签
	 *
	 * @param editBaseCodeTypeReqVo
	 * @return
	 */
	@PostMapping(value = "/editBaseCodeType", produces = "application/json")
	public String editBaseCodeType(@RequestBody EditBaseCodeTypeReqVo editBaseCodeTypeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(editBaseCodeTypeHander.hander(editBaseCodeTypeReqVo));
		} catch (Exception e) {
			logger.error("editBaseCodeType error: {}", e);
		}
		return null;
	}
	
	/**
	 * 删除标签
	 *
	 * @param delBaseCodeTypeReqVo
	 * @return
	 */
	@PostMapping(value = "/delBaseCodeType", produces = "application/json")
	public String delBaseCodeType(@RequestBody DelBaseCodeTypeReqVo delBaseCodeTypeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(delBaseCodeTypeHander.hander(delBaseCodeTypeReqVo));
		} catch (Exception e) {
			logger.error("delBaseCodeType error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取字典类型值
	 *
	 * @param getBaseCodeValueListReqVo
	 * @return
	 */
	@PostMapping(value = "/getBaseCodeValueList", produces = "application/json")
	public String getBaseCodeValueList(@RequestBody GetBaseCodeValueListReqVo getBaseCodeValueListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getBaseCodeValueListHander.hander(getBaseCodeValueListReqVo));
		} catch (Exception e) {
			logger.error("getBaseCodeValueList error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取字典类型page
	 *
	 * @param getBaseCodeValuePageReqVo
	 * @return
	 */
	@PostMapping(value = "/getBaseCodeValuePage", produces = "application/json")
	public String getBaseCodeValuePage(@RequestBody GetBaseCodeValuePageReqVo getBaseCodeValuePageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getBaseCodeValuePageHander.hander(getBaseCodeValuePageReqVo));
		} catch (Exception e) {
			logger.error("getBaseCodeValuePage error: {}", e);
		}
		return null;
	}
	
	/**
	 * 新增类型值
	 *
	 * @param addBaseCodeValueReqVo
	 * @return
	 */
	@PostMapping(value = "/addBaseCodeValue", produces = "application/json")
	public String addBaseCodeValue(@RequestBody AddBaseCodeValueReqVo addBaseCodeValueReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addBaseCodeValueHander.hander(addBaseCodeValueReqVo));
		} catch (Exception e) {
			logger.error("addBaseCodeValue error: {}", e);
		}
		return null;
	}
	
	/**
	 * 修改类型值
	 *
	 * @param editBaseCodeValueReqVo
	 * @return
	 */
	@PostMapping(value = "/editBaseCodeValue", produces = "application/json")
	public String editBaseCodeValue(@RequestBody EditBaseCodeValueReqVo editBaseCodeValueReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(editBaseCodeValueHander.hander(editBaseCodeValueReqVo));
		} catch (Exception e) {
			logger.error("editBaseCodeValue error: {}", e);
		}
		return null;
	}
	
	/**
	 * 删除类型值
	 *
	 * @param delBaseCodeValueReqVo
	 * @return
	 */
	@PostMapping(value = "/delBaseCodeValue", produces = "application/json")
	public String delBaseCodeValue(@RequestBody DelBaseCodeValueReqVo delBaseCodeValueReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(delBaseCodeValueHander.hander(delBaseCodeValueReqVo));
		} catch (Exception e) {
			logger.error("delBaseCodeValue error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取公司角色(根据登录人的公司,获取公司下的所有有效角色,用于下拉框)
	 *
	 * @param getChannelRoleListReqVo
	 * @return
	 */
	@PostMapping(value = "/getChannelRoleList", produces = "application/json")
	public String getChannelRoleList(@RequestBody GetChannelRoleListReqVo getChannelRoleListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getChannelRoleListHander.hander(getChannelRoleListReqVo));
		} catch (Exception e) {
			logger.error("getChannelRoleList error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取公司角色(根据登录人的公司,获取公司下的所有有效角色,用于下拉框)
	 *
	 * @param getChannelRolePageReqDtoVo
	 * @return
	 */
	@PostMapping(value = "/getChannelRolePage", produces = "application/json")
	public String getChannelRolePage(@RequestBody GetChannelRolePageReqDtoVo getChannelRolePageReqDtoVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getChannelRolePageHander.hander(getChannelRolePageReqDtoVo));
		} catch (Exception e) {
			logger.error("getChannelRolePage error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取角色信息详情
	 *
	 * @param getRoleByIdReqVo
	 * @return
	 */
	@PostMapping(value = "/getRoleById", produces = "application/json")
	public String getRoleById(@RequestBody GetRoleByIdReqVo getRoleByIdReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getRoleByIdHander.hander(getRoleByIdReqVo));
		} catch (Exception e) {
			logger.error("getRoleById error: {}", e);
		}
		return null;
	}
	
	/**
	 * 新增角色
	 *
	 * @param addChannelRoleReq
	 * @return
	 */
	@PostMapping(value = "/addChannelRole", produces = "application/json")
	public String addChannelRole(@RequestBody AddChannelRoleReqVo addChannelRoleReq) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addChannelRoleHander.hander(addChannelRoleReq));
		} catch (Exception e) {
			logger.error("addChannelRole error: {}", e);
		}
		return null;
	}
	
	/**
	 * 编辑角色
	 *
	 * @param editChannelRoleReq
	 * @return
	 */
	@PostMapping(value = "/editChannelRole", produces = "application/json")
	public String editChannelRole(@RequestBody EditChannelRoleReqVo editChannelRoleReq) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(editChannelRoleHander.hander(editChannelRoleReq));
		} catch (Exception e) {
			logger.error("editChannelRole error: {}", e);
		}
		return null;
	}
	
	/**
	 * 删除角色
	 *
	 * @param delChannelRoleReqVo
	 * @return
	 */
	@PostMapping(value = "/delChannelRole", produces = "application/json")
	public String delChannelRole(@RequestBody DelChannelRoleReqVo delChannelRoleReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(delChannelRoleHander.hander(delChannelRoleReqVo));
		} catch (Exception e) {
			logger.error("delChannelRole error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param getCustomerPremisesReqVo
	 * @param request
	 * @description 获取个人佣金
	 * @author sangtao
	 * @date 2017/11/27
	 **/
	@Domain
	@PostMapping("/getCustomerPremises")
	public String getCustomerPremises(HttpServletRequest request, @RequestBody GetCustomerPremisesReqVo getCustomerPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCustomerPremisesHander.hander(getCustomerPremisesReqVo));
		} catch (Exception e) {
			logger.error("getCustomerPremises error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param getPremisesCommissionReqVo
	 * @param request
	 * @description 获取楼盘佣金
	 * @author sangtao
	 * @date 2017/11/27
	 **/
	@Domain
	@PostMapping("/getPremisesCommission")
	public String getPremisesCommission(HttpServletRequest request, @RequestBody GetPremisesCommissionReqVo getPremisesCommissionReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPremisesCommissionHander.hander(getPremisesCommissionReqVo));
		} catch (Exception e) {
			logger.error("getPremisesCommission error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param getOrgCommissionPageReqVo
	 * @param request
	 * @description
	 * @author sangtao
	 * @date 2017/11/28
	 **/
	@Domain
	@PostMapping("/getOrgCommissionPage")
	public String getOrgCommissionPage(HttpServletRequest request, @RequestBody GetOrgCommissionPageReqVo getOrgCommissionPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getOrgCommissionPageHander.hander(getOrgCommissionPageReqVo));
		} catch (Exception e) {
			logger.error("getOrgCommissionPage error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param dealCommissionPageReqVo
	 * @param request
	 * @description 机构结佣
	 * @author sangtao
	 * @date 2017/11/28
	 **/
	@Domain
	@PostMapping("/dealCommission")
	public String dealCommission(HttpServletRequest request, @RequestBody DealCommissionReqVo dealCommissionPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(dealCommissionHander.hander(dealCommissionPageReqVo));
		} catch (Exception e) {
			logger.error("dealCommission error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param getSettlementRecordReqVo
	 * @param request
	 * @description 机构佣金详情（报备列表）
	 * @author sangtao
	 * @date 2017/11/28
	 **/
	@Domain
	@PostMapping("/getSettlementRecord")
	public String getSettlementRecord(HttpServletRequest request, @RequestBody GetSettlementRecordReqVo getSettlementRecordReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getSettlementRecordHander.hander(getSettlementRecordReqVo));
		} catch (Exception e) {
			logger.error("getSettlementRecord error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param addCRReqVo
	 * @param request
	 * @description 添加佣金规则(开发商)
	 * @author sangtao
	 * @date 2017/11/28
	 **/
	@Domain
	@PostMapping("/addCR")
	public String addCR(HttpServletRequest request, @RequestBody AddCRReqVo addCRReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addCRHander.hander(addCRReqVo));
		} catch (Exception e) {
			logger.error("addCR error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param updateCRReqVo
	 * @param request
	 * @description 修改佣金规则(开发商)
	 * @author sangtao
	 * @date 2017/11/28
	 **/
	@Domain
	@PostMapping("/updateCR")
	public String updateCR(HttpServletRequest request, @RequestBody UpdateCRReqVo updateCRReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(updateCRHander.hander(updateCRReqVo));
		} catch (Exception e) {
			logger.error("updateCR error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param getCRDetailReqVo
	 * @param request
	 * @description 获取佣金规则(开发商)
	 * @author sangtao
	 * @date 2017/11/28
	 **/
	@Domain
	@PostMapping("/getCRDetail")
	public String getCRDetail(HttpServletRequest request, @RequestBody GetCRDetailReqVo getCRDetailReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCRDetailHander.hander(getCRDetailReqVo));
		} catch (Exception e) {
			logger.error("getCRDetail error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param toUpdateCRReqVo
	 * @param request
	 * @description 获取佣金规则(开发商), 更新佣金规则时
	 * @author sangtao
	 * @date 2017/11/28
	 **/
	@Domain
	@PostMapping("/toUpdateCR")
	public String toUpdateCR(HttpServletRequest request, @RequestBody ToUpdateCRReqVo toUpdateCRReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(toUpdateCRHander.hander(toUpdateCRReqVo));
		} catch (Exception e) {
			logger.error("toUpdateCR error: {}", e);
		}
		return null;
	}
	
	@Domain
	@PostMapping(value = "/addDept", produces = "application/json")
	public String addDept(HttpServletRequest request, @RequestBody AddDeptReqVo addDeptReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addDeptHander.hander(addDeptReqVo));
		} catch (Exception e) {
			logger.error("addDept error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/editDept", produces = "application/json")
	public String editDept(HttpServletRequest request, @RequestBody EditDeptReqVo editDeptReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(editDeptHander.hander(editDeptReqVo));
		} catch (Exception e) {
			logger.error("editDept error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/delDept", produces = "application/json")
	public String delDept(HttpServletRequest request, @RequestBody DelDeptReqVo delDeptReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(delDeptHander.hander(delDeptReqVo));
		} catch (Exception e) {
			logger.error("delDept error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/addAgentDept", produces = "application/json")
	public String addAgentDept(HttpServletRequest request, @RequestBody AddAgentDeptReqVo reqDVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addAgentDeptHander.hander(reqDVo));
		} catch (Exception e) {
			logger.error("addAgentDept error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/editAgentDept", produces = "application/json")
	public String editAgentDept(HttpServletRequest request, @RequestBody EditAgentDeptReqVo reqDVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(editAgentDeptHander.hander(reqDVo));
		} catch (Exception e) {
			logger.error("editAgentDept error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getDeptById", produces = "application/json")
	public String getDeptById(HttpServletRequest request, @RequestBody GetDeptByIdReqVo getDeptByIdReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getDeptByIdHander.hander(getDeptByIdReqVo));
		} catch (Exception e) {
			logger.error("getDeptById error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getDeptTree", produces = "application/json")
	public String getDeptTree(HttpServletRequest request, @RequestBody GetDeptTreeReqVo deptTreeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getDeptTreeHander.hander(deptTreeReqVo));
		} catch (Exception e) {
			logger.error("getDeptTree error: {}", e);
			return null;
		}
	}

	/**
	 * 点击转移按钮获取部门结点图
	 *
	 * @method: onClickChange
	 * @param: [request, reqVo]
	 * @return: java.lang.String
	 */
	@Domain
	@PostMapping(value = "getDeptTreeToSecond", produces = "application/json")
	public String getDeptTreeToSecond(HttpServletRequest request, @RequestBody GetDeptTreeReqVo deptTreeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getChangeDeptTreeHandler.hander(deptTreeReqVo));
		} catch (Exception e) {
			logger.error("getDeptTreeToSecond error: {}", e);
		}
		return null;
	}
	
	@PostMapping(value = "/getAgentOrgByDevOrg", produces = "application/json")
	public String getAgentOrgByDevOrg(HttpServletRequest request, @RequestBody GetAgentOrgByDevOrgReqVo getAgentOrgByDevOrgReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentOrgByDevOrgHander.hander(getAgentOrgByDevOrgReqVo));
		} catch (Exception e) {
			logger.error("getAgentOrgByDevOrg error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getAgentOrgByPremises", produces = "application/json")
	public String getAgentOrgByPremises(HttpServletRequest request, @RequestBody GetAgentOrgByPremisesReqVo getAgentOrgByPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentOrgByPremisesHander.hander(getAgentOrgByPremisesReqVo));
		} catch (Exception e) {
			logger.error("getAgentOrgByPremises error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/addAgentOrg", produces = "application/json")
	public String addAgentOrg(HttpServletRequest request, @RequestBody AddAgentOrgReqVo addAgentOrgReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			addAgentOrgReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(addAgentOrgHander.hander(addAgentOrgReqVo));
		} catch (Exception e) {
			logger.error("addAgentOrg error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/updateAgentOrg", produces = "application/json")
	public String updateAgentOrg(HttpServletRequest request, @RequestBody UpdateAgentOrgReqVo updateAgentOrgReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			updateAgentOrgReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(updateAgentOrgHander.hander(updateAgentOrgReqVo));
		} catch (Exception e) {
			logger.error("updateAgentOrg error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getAgentOrgTree", produces = "application/json")
	public String getAgentOrgTree(HttpServletRequest request, @RequestBody GetAgentOrgTreeReqVo getAgentOrgTreeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentOrgTreeHander.hander(getAgentOrgTreeReqVo));
		} catch (Exception e) {
			logger.error("getAgentOrgTree error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getAgentOrgAuditPage", produces = "application/json")
	public String getAgentOrgAuditPage(HttpServletRequest request, @RequestBody GetAgentOrgAuditPageReqVo getAgentOrgAuditPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentOrgAuditPageHander.hander(getAgentOrgAuditPageReqVo));
		} catch (Exception e) {
			logger.error("getAgentOrgAuditPage error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/agentOrgAudit", produces = "application/json")
	public String agentOrgAudit(HttpServletRequest request, @RequestBody AgentOrgAuditReqVo agentOrgAuditReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			agentOrgAuditReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(agentOrgAuditHander.hander(agentOrgAuditReqVo));
		} catch (Exception e) {
			logger.error("agentOrgAudit error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getAgentOrgByCompanyList", produces = "application/json")
	public String getAgentOrgByCompanyList(HttpServletRequest request, @RequestBody GetAgentOrgByCompanyListReqVo getAgentOrgByCompanyListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentOrgByCompanyListHander.hander(getAgentOrgByCompanyListReqVo));
		} catch (Exception e) {
			logger.error("getAgentOrgByCompanyList error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getAgentOrgCountByCompany", produces = "application/json")
	public String getAgentOrgCountByCompany(HttpServletRequest request, @RequestBody GetAgentOrgCountByCompanyReqVo getAgentOrgCountByCompanyReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentOrgCountByCompanyHander.hander(getAgentOrgCountByCompanyReqVo));
		} catch (Exception e) {
			logger.error("getAgentOrgCountByCompany error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/importOrg", produces = "application/json")
	public String importOrg(MultipartHttpServletRequest request, ImportOrgReqVo importOrgReqVo) {
		try {
			importOrgReqVo.setMulRequest(request);
			return JSONUtil.toJSONStringWithDateFormat(importOrgHander.doBusiness(importOrgReqVo));
		} catch (Exception e) {
			logger.error("importOrg error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/getAgentOrgByCompanyCode", produces = "application/json")
	public String getAgentOrgByCompanyCode(HttpServletRequest request,
		@RequestBody GetAgentOrgByCompanyCodeReqVo getAgentOrgCountByCompanyCodeReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getAgentOrgCountByCompanyCodeReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getAgentOrgByCompanyCodeHander.hander(getAgentOrgCountByCompanyCodeReqVo));
		} catch (Exception e) {
			logger.error("getAgentOrgByCompanyCode error: {}", e);
			return null;
		}
	}
	
	@Domain
	@PostMapping(value = "/bindCompanyCode", produces = "application/json")
	public String bindCompanyCode(HttpServletRequest request, @RequestBody BindCompanyCodeReqVo bindCompanyCodeReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			bindCompanyCodeReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(bindCompanyCodeHander.hander(bindCompanyCodeReqVo));
		} catch (Exception e) {
			logger.error("bindCompanyCode error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getCompanyByUserId", produces = "application/json")
	public String getCompanyByUserId(HttpServletRequest request, @RequestBody GetCompanyByUserIdReqVo getCompanyByUserIdReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCompanyByUserIdHander.hander(getCompanyByUserIdReqVo));
		} catch (Exception e) {
			logger.error("getCompanyByUserId error: {}", e);
			return null;
		}
	}
	
	@PostMapping(value = "/getCompanyForCommissionRule", produces = "application/json")
	public String getCompanyForCommissionRule(HttpServletRequest request,
		@RequestBody GetCompanyForCommissionRuleReqVo getCompanyForCommissionRuleReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCompanyForCommissionRuleHander.hander(getCompanyForCommissionRuleReqVo));
		} catch (Exception e) {
			logger.error("getCompanyForCommissionRule error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param resetPwdReqVo
	 * @Description 1重置密码，校验短信验证码
	 * @Author sangtao
	 * @Date 2017/11/23
	 **/
	@Domain
	@PostMapping("/resetPwd")
	public String resetPwd(HttpServletRequest request, @RequestBody ResetPwdReqVo resetPwdReqVo) {
		try {
//			String loginType = resetPwdReqVo.getParams().getLoginType();
//			if (!("5".equals(loginType) || "6".equals(loginType))) {
//				String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//				resetPwdReqVo.getParams().setDomain(domain);
//			}
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			resetPwdReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(resetPwdHander.hander(resetPwdReqVo));
		} catch (Exception e) {
			logger.error("resetPwd error: {}", e);
			return null;
		}
	}

	/**
	 * @param request
	 * @param resetPwdByForgetReqVo
	 * @Description 验证码通过后，重置用户密码
	 **/
	@Domain
	@PostMapping("/resetPwdByForget")
	public String resetPwdByForget(HttpServletRequest request, @RequestBody ResetPwdByForgetReqVo resetPwdByForgetReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(resetPwdByForgetHander.hander(resetPwdByForgetReqVo));
		} catch (Exception e) {
			logger.error("resetPwd error: {}", e);
			return null;
		}
	}

	/**
	 * @param request
	 * @param updatePwdReqVo
	 * @Description 修改密码
	 * @Author sangtao
	 * @Date 2017/11/23
	 **/
	@Domain
	@PostMapping("/updatePwd")
	public String updatePwd(HttpServletRequest request, @RequestBody UpdatePwdReqVo updatePwdReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(updatePwdHander.hander(updatePwdReqVo));
		} catch (Exception e) {
			logger.error("updatePwd error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param delPartnerReqVo
	 * @Description 删除人员
	 * @Author sangtao
	 * @Date 2017/11/23
	 **/
	@Domain
	@PostMapping("/delPartner")
	public String delPartner(HttpServletRequest request, @RequestBody DelPartnerReqVo delPartnerReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(delPartnerHander.hander(delPartnerReqVo));
		} catch (Exception e) {
			logger.error("delPartner error: {}", e);
			return null;
		}
	}

	/***
	 * 获取分销机构列表
	 * @method: getAgentList
	 * @param: [getAgentListReqVo]
	 * @return: java.lang.String
	 */
	@PostMapping("/getAgentList")
	public String getAgentList(@RequestBody GetAgentListReqVo getAgentListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentListHander.hander(getAgentListReqVo));
		} catch (Exception e) {
			logger.error("getAgentList error: {}", e);
			return null;
		}
	}

	/**
	 * 通过部门id获取部门及子部门以下所有人员
	 * @method: getPartnerByDeptId
	 * @param: [getAgentPartnerPageReqVo]
	 * @return: java.lang.String
	 */
	@PostMapping("/getPartnerInfoByDept")
	public String getPartnerInfoByDept(@RequestBody GetAgentPartnerPageReqVo getAgentPartnerPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPartnerInfoByDeptHander.hander(getAgentPartnerPageReqVo));
		} catch (Exception e) {
			logger.error("getPartnerInfoByDept error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param forbiddenOrNotPartnerReqVo
	 * @Description 启用，禁用用户
	 * @Author sangtao
	 * @Date 2017/11/23
	 **/
	@Domain
	@PostMapping("/forbiddenOrNotPartner")
	public String forbiddenOrNotPartner(HttpServletRequest request, @RequestBody ForbiddenOrNotPartnerReqVo forbiddenOrNotPartnerReqVo) {
		try {
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			forbiddenOrNotPartnerReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(forbiddenOrNotPartnerHander.hander(forbiddenOrNotPartnerReqVo));
		} catch (Exception e) {
			logger.error("forbiddenOrNotPartner error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getDevPartnerPageReqVo
	 * @Description 渠道经纪人
	 * @Author sangtao
	 * @Date 2017/11/24
	 **/
	@Domain
	@PostMapping("/getDevPartnerPage")
	public String getDevPartnerPage(HttpServletRequest request, @RequestBody GetDevPartnerPageReqVo getDevPartnerPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getDevPartnerPageHander.hander(getDevPartnerPageReqVo));
		} catch (Exception e) {
			logger.error("getDevPartnerPage error: {}", e);
			return null;
		}
	}

	/**
	 * 设置驻场人员时，查看除超级管理员外的所有成员
	 * @param request
	 * @param getDevPartnerPageReqVo
	 * @return
	 */
	@Domain
	@PostMapping("/getDevNewPartnerPage")
	public String getDevNewPartnerPage(HttpServletRequest request, @RequestBody GetDevPartnerPageReqVo getDevPartnerPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getDevNewPartnerPageHander.hander(getDevPartnerPageReqVo));
		} catch (Exception e) {
			logger.error("getDevNewPartnerPage error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getAgentPartnerPageReqVo
	 * @Description 分销经纪人
	 * @Author sangtao
	 * @Date 2017/11/24
	 **/
	@Domain
	@PostMapping("/getAgentPartnerPage")
	public String getAgentPartnerPage(HttpServletRequest request, @RequestBody GetAgentPartnerPageReqVo getAgentPartnerPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentPartnerPageHander.hander(getAgentPartnerPageReqVo));
		} catch (Exception e) {
			logger.error("getAgentPartnerPage error: {}", e);
			return null;
		}
	}

	/** 
	 * @method: agentRegisterSwitch
	 * @param: [agentRegisterSwitchReqVo] 
	 * @return: java.lang.String
	 */
	@Domain
	@PostMapping("/agentRegisterSwitch")
	public String agentRegisterSwitch(@RequestBody AgentRegisterSwitchReqVo agentRegisterSwitchReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(agentRegisterSwitchHander.hander(agentRegisterSwitchReqVo));
		} catch (Exception e) {
			logger.error("agentRegisterSwitch error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param reqVo
	 * @Description 新增经纪人
	 * @Author JHSong
	 * @Date 2017/12/05
	 **/
	@Domain
	@PostMapping("/addPartner")
	public String addPartner(HttpServletRequest request, @RequestBody AddPartnerReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			reqVo.getParams().setDomain(domain);
//			reqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(addPartnerHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("addPartner error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param reqVo
	 * @Description 新增经纪人
	 * @Author JHSong
	 * @Date 2017/12/05
	 **/
	@Domain
	@PostMapping("/addPartnerQuick")
	public String addPartnerQuick(HttpServletRequest request, @RequestBody AddPartnerQuickReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			reqVo.getParams().setDomain(domain);
//			reqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(addPartnerQuickHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("addPartnerQuick error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param reqVo
	 * @Description 新增经纪人
	 * @Author JHSong
	 * @Date 2017/12/05
	 **/
	@Domain
	@PostMapping("/editPartner")
	public String editPartner(HttpServletRequest request, @RequestBody EditPartnerReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			reqVo.getParams().setDomain(domain);
//			reqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(editPartnerHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("editPartner error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getPartnerByCompanyReqVo
	 * @description 根据公司获取经纪人
	 * @author sangtao
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping("/getPartnerByCompany")
	public String getPartnerByCompany(HttpServletRequest request, @RequestBody GetPartnerByCompanyReqVo getPartnerByCompanyReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPartnerByCompanyHander.hander(getPartnerByCompanyReqVo));
		} catch (Exception e) {
			logger.error("getPartnerByCompany error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getPartnerByPremisesReqVo
	 * @description 楼盘相关经纪人接口
	 * @author sangtao
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping("/getPartnerByPremises")
	public String getPartnerByPremises(HttpServletRequest request, @RequestBody GetPartnerByPremisesReqVo getPartnerByPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPartnerByPremisesHander.hander(getPartnerByPremisesReqVo));
		} catch (Exception e) {
			logger.error("getPartnerByPremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getPartnerByAgentOrgReqVo
	 * @description 获取中介经纪人接口
	 * @author sangtao
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping("/getPartnerByAgentOrg")
	public String getPartnerByAgentOrg(HttpServletRequest request, @RequestBody GetPartnerByAgentOrgReqVo getPartnerByAgentOrgReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPartnerByAgentOrgHander.hander(getPartnerByAgentOrgReqVo));
		} catch (Exception e) {
			logger.error("getPartnerByAgentOrg error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getPartnerCountByAgentOrgReqVo
	 * @description 获取中介经纪人总数（中介公司启用的经纪人数量）
	 * @author sangtao
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping("/getPartnerCountByAgentOrg")
	public String getPartnerCountByAgentOrg(HttpServletRequest request, @RequestBody GetPartnerCountByAgentOrgReqVo getPartnerCountByAgentOrgReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPartnerCountByAgentOrgHander.hander(getPartnerCountByAgentOrgReqVo));
		} catch (Exception e) {
			logger.error("getPartnerCountByAgentOrg error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getPartnerByDeptReqVo
	 * @description 获取中介经纪人总数（中介公司启用的经纪人数量）
	 * @author sangtao
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping("/getPartnerByDept")
	public String getPartnerByDept(HttpServletRequest request, @RequestBody GetPartnerByDeptReqVo getPartnerByDeptReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPartnerByDeptHander.hander(getPartnerByDeptReqVo));
		} catch (Exception e) {
			logger.error("getPartnerByDept error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param getUserByIdReqVo
	 * @description 实时获取用户信息
	 * @author sangtao
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping(value = "/getUserById", produces = "application/json")
	public String getUserById(HttpServletRequest request, @RequestBody GetUserByIdReqVo getUserByIdReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getUserByIdHander.doBusiness(getUserByIdReqVo));
		} catch (Exception e) {
			logger.error("getUserById error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @description 获取经纪人信息
	 * @author JHSong
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping(value = "/getPartnerDetail", produces = "application/json")
	public String getPartnerDetail(HttpServletRequest request, @RequestBody GetPartnerDetailReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPartnerDetailHander.doBusiness(reqVo));
		} catch (Exception e) {
			logger.error("getPartnerDetail error: {}", e);
			return null;
		}
	}
	
	/**
	 * @param request
	 * @param importUserReqVo
	 * @param fileRequst
	 * @description 批量导入人员
	 * @author sangtao
	 * @date 2017/11/25
	 **/
	@Domain
	@PostMapping(value = "/importUser", produces = "application/json")
	public String importUser(HttpServletRequest request, @RequestBody ImportUserReqVo importUserReqVo, MultipartHttpServletRequest fileRequst) {
		try {
			importUserReqVo.getParams().setMulRequest(fileRequst);
			return JSONUtil.toJSONStringWithDateFormat(importUserHander.doBusiness(importUserReqVo));
		} catch (Exception e) {
			logger.error("importUser error: {}", e);
			return null;
		}
	}
	
	@SuppressWarnings("unchecked")
	@GetMapping(value = "/exportPartner", produces = "application/json")
	public void exportPartner(HttpServletRequest request, HttpServletResponse response, ExportPartnerReqVo reqVo) {
		try {
			BaseResponseDTO<ExportPartnerResDto> baseResDto = exportPartnerHander.doBusiness(reqVo);
			ExportPartnerResDto resDto = baseResDto.getResData();
			
			List<String[]> headerList = new ArrayList<String[]>(); // 表头
			String[] header = new String[] {"机构名称", "员工姓名", "手机号",  "角色", "状态", "是否为管理员", "渠道经理"};
			headerList.add(header);
			
			if (null != resDto.getExportPartnerList()) {
				String[] name = new String[] {"合作机构信息"};
				// 组装excel
				Export.exportReportExcel(resDto.getExportPartnerList(), headerList, name, response);
			}
		} catch (Exception e) {
			logger.error("exportPartner error: {}", e);
		}
	}
	
	/**
	 * 角色授权资源列表
	 *
	 * @param getAuthorizeRoleListReqVo
	 * @return
	 */
	@PostMapping(value = "/getAuthorizeRoleList", produces = "application/json")
	public String getAuthorizeRoleList(@RequestBody GetAuthorizeRoleListReqVo getAuthorizeRoleListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAuthorizeRoleListHander.hander(getAuthorizeRoleListReqVo));
		} catch (Exception e) {
			logger.error("getAuthorizeRoleList error: {}", e);
		}
		return null;
	}
	
	/**
	 * 角色授权
	 *
	 * @param authorizeRoleReqVo
	 * @return
	 */
	@PostMapping(value = "/authorizeRole", produces = "application/json")
	public String authorizeRole(@RequestBody AuthorizeRoleReqVo authorizeRoleReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(authorizeRoleHander.hander(authorizeRoleReqVo));
		} catch (Exception e) {
			logger.error("authorizeRole error: {}", e);
		}
		return null;
	}
	
	/**
	 * 经纪人排行
	 *
	 * @param getAgentRankPageReqVo
	 * @return
	 */
	@PostMapping(value = "/getAgentRankPage", produces = "application/json")
	public String getAgentRankPage(@RequestBody GetAgentRankPageReqVo getAgentRankPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentRankPageHander.hander(getAgentRankPageReqVo));
		} catch (Exception e) {
			logger.error("getAgentRankPage error: {}", e);
		}
		return null;
	}
	
	/**
	 * 经纪人排行导出
	 *
	 * @param getAgentRankExportReqVo
	 * @return
	 */
	@GetMapping(value = "/getAgentRankExport", produces = "application/json")
	public void getAgentRankExport(GetAgentRankExportReqVo getAgentRankExportReqVo, HttpServletResponse response) {
		try {
			BaseResponseDTO<GetAgentRankExportResDto> resDto = getAgentRankExportHander.hander(getAgentRankExportReqVo);
			Page<AgentRankReport> agentRankReportPage = resDto.getResData().getAgentRankReportPage();
			Export.exportAgentExcel(agentRankReportPage.getRows(), response);
		} catch (Exception e) {
			logger.error("getAgentRankExport error: {}", e);
		}
	}

	/**
	 * 客户转化表
	 *
	 * @param getCustomerConversionPageReqVo
	 * @return
	 */
	@PostMapping(value = "/getCustomerConversionPage", produces = "application/json")
	public String getCustomerConversionPage(@RequestBody GetCustomerConversionPageReqVo getCustomerConversionPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCustomerConversionPageHander.hander(getCustomerConversionPageReqVo));
		} catch (Exception e) {
			logger.error("getCustomerConversionPage error: {}", e);
		}
		return null;
	}

	/**
	 * 通过楼盘导出推荐人业务报表
	 * @method: getDevPremisesExport
	 * @param: [getDevPremisesExportReqVo, response]
	 * @return: void
	 */
	@GetMapping(value = "/getExportRecommendByPre",produces = "application/json")
	public void	getExportRecommendByPre(GetDevPremisesExportReqVo getDevPremisesExportReqVo,HttpServletResponse response) {
		try {
			getDevPremisesExportReqVo.getParams().setStatus("1");
			BaseResponseDTO<GetDevPremisesExportResDto> resDto = exportReportRecommendHander.hander(getDevPremisesExportReqVo);
			List<DevPremisesExport> infoList = resDto.getResData().getDevPremisesExportList();
			String expirationDate = resDto.getResData().getExpirationDate();
			String startDate = resDto.getResData().getStartDate();
			// 组装导出数据
			// sheet
			String[] name = new String[] {"统计时间截止至"};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();

			// 项目客户推荐表
			String[] header = new String[] {"排行","楼盘名称","楼盘状态","推荐过的推荐人", "推荐客户", "推荐成功客户", "到访客户", "认筹客户", "认购客户", "签约客户","签约金额", "签约率"};
			headerList.add(header);

			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			BigDecimal totalFour = new BigDecimal("0");
			BigDecimal totalFive = new BigDecimal("0");
			BigDecimal totalSix = new BigDecimal("0");
			BigDecimal totalSeven = new BigDecimal("0");
			BigDecimal totalEight = new BigDecimal("0");
			String signRate = null;
			List<Map<String, String>> mapList = new ArrayList<>();
			for (int i = 0; i < infoList.size(); i++) {
				DevPremisesExport dpe = infoList.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, (i+1)+"");
				map.put(header[1] + "_" + i, dpe.getPremisesName());
				map.put(header[2] + "_" + i, dpe.getPremisesStatus());

				String countOne = dpe.getRecommenderCount() + "";
				totalOne = totalOne.add(new BigDecimal(countOne));
				map.put(header[3] + "_" + i, countOne);
				String countTwo = dpe.getCustomerCount() + "";
				totalTwo = totalTwo.add(new BigDecimal(countTwo));
				map.put(header[4] + "_" + i, countTwo);
				String countThree = dpe.getCustomerSuccessCount() + "";
				totalThree = totalThree.add(new BigDecimal(countThree));
				map.put(header[5] + "_" + i, countThree);
				String countFour = dpe.getVisitCustomerCount() + "";
				totalFour = totalFour.add(new BigDecimal(countFour));
				map.put(header[6] + "_" + i, countFour);
				String countFive = dpe.getRaiseCount() + "";
				totalFive = totalFive.add(new BigDecimal(countFive));
				map.put(header[7] + "_" + i, countFive);
				String countSix = dpe.getPurchaseCount() + "";
				totalSix = totalSix.add(new BigDecimal(countSix));
				map.put(header[8] + "_" + i, countSix);
				String countSeven = dpe.getSignCount() + "";
				totalSeven = totalSeven.add(new BigDecimal(countSeven));
				map.put(header[9] + "_" + i, countSeven);

				String countEight = dpe.getSignMoney() + "";
				totalEight = totalEight.add(new BigDecimal(countEight));
				map.put(header[10] + "_" + i, countEight);

				signRate = CalculateUtil.signRate(countThree,countSeven);
				map.put(header[11] + "_" + i, signRate);
				mapList.add(map);
			}
			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + mapList.size(), "合计");
			totalMap.put(header[3] + "_" + mapList.size(), totalOne.toString());
			totalMap.put(header[4] + "_" + mapList.size(), totalTwo.toString());
			totalMap.put(header[5] + "_" + mapList.size(), totalThree.toString());
			totalMap.put(header[6] + "_" + mapList.size(), totalFour.toString());
			totalMap.put(header[7] + "_" + mapList.size(), totalFive.toString());
			totalMap.put(header[8] + "_" + mapList.size(), totalSix.toString());
			totalMap.put(header[9] + "_" + mapList.size(), totalSeven.toString());
			totalMap.put(header[10] + "_" + mapList.size(), totalEight.toString());

			mapList.add(totalMap);
			list.add(mapList);

			// 推荐人业务报表截至时间
			if (StringUtils.isEmpty(startDate)) {
				startDate = "";
			}
			String fileName = "推荐人业务报表(按楼盘)" + startDate + "至" + expirationDate;
			name[0] += expirationDate;
			// 组装excel
			Export.exportDevPremisesInfo(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getDevPremisesExport error: {}", e);
		}
	}

	/**
	 * 通过推荐人导出业务报表
	 * @method: getDevPremisesExportByRem
	 * @param: [getDevPremisesExportReqVo, response]
	 * @return: void
	 */
	@GetMapping(value = "/getExportRecommendByRec",produces = "application/json")
	public void	getExportRecommendByRec(GetDevPremisesExportReqVo getDevPremisesExportReqVo,HttpServletResponse response) {
		try {
			getDevPremisesExportReqVo.getParams().setStatus("0");
			BaseResponseDTO<GetDevPremisesExportResDto> resDto = exportReportRecommendHander.hander(getDevPremisesExportReqVo);
			List<DevPremisesExport> infoList = resDto.getResData().getDevPremisesExportList();
			String expirationDate = resDto.getResData().getExpirationDate();
			String startDate = resDto.getResData().getStartDate();
			// 组装导出数据
			// sheet
			String[] name = new String[] {"统计时间截止至"};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();

			// 项目客户推荐表
			String[] header = new String[] {"排行","推荐人","推荐人组织架构", "推荐楼盘", "推荐客户", "推荐成功客户", "到访客户", "认筹客户", "认购客户", "签约客户","签约金额","签约率"};
			headerList.add(header);

			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			BigDecimal totalFour = new BigDecimal("0");
			BigDecimal totalFive = new BigDecimal("0");
			BigDecimal totalSix = new BigDecimal("0");
			BigDecimal totalSeven = new BigDecimal("0");
			BigDecimal totalEight = new BigDecimal("0");
			String signRate = null;
			List<Map<String, String>> mapList = new ArrayList<>();
			for (int i = 0; i < infoList.size(); i++) {
				DevPremisesExport dpe = infoList.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, (i+1)+"");
				map.put(header[1] + "_" + i, dpe.getRecommender());
				map.put(header[2] + "_" + i, dpe.getRecommenderOrgChart());

				String countOne = dpe.getPremisesCount() + "";
				totalOne = totalOne.add(new BigDecimal(countOne));
				map.put(header[3] + "_" + i, countOne);
				String countTwo = dpe.getCustomerCount() + "";
				totalTwo = totalTwo.add(new BigDecimal(countTwo));
				map.put(header[4] + "_" + i, countTwo);
				String countThree = dpe.getCustomerSuccessCount() + "";
				totalThree = totalThree.add(new BigDecimal(countThree));
				map.put(header[5] + "_" + i, countThree);
				String countFour = dpe.getVisitCustomerCount() + "";
				totalFour = totalFour.add(new BigDecimal(countFour));
				map.put(header[6] + "_" + i, countFour);
				String countFive = dpe.getRaiseCount() + "";
				totalFive = totalFive.add(new BigDecimal(countFive));
				map.put(header[7] + "_" + i, countFive);
				String countSix = dpe.getPurchaseCount() + "";
				totalSix = totalSix.add(new BigDecimal(countSix));
				map.put(header[8] + "_" + i, countSix);
				String countSeven = dpe.getSignCount() + "";
				totalSeven = totalSeven.add(new BigDecimal(countSeven));
				map.put(header[9] + "_" + i, countSeven);

				String countEight = dpe.getSignMoney() + "";
				totalEight = totalEight.add(new BigDecimal(countEight));
				map.put(header[10] + "_" + i, countEight);

				signRate = CalculateUtil.signRate(countThree,countSeven);
				map.put(header[11] + "_" + i, signRate);
				mapList.add(map);
			}
			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + mapList.size(), "合计");
			totalMap.put(header[3] + "_" + mapList.size(), totalOne.toString());
			totalMap.put(header[4] + "_" + mapList.size(), totalTwo.toString());
			totalMap.put(header[5] + "_" + mapList.size(), totalThree.toString());
			totalMap.put(header[6] + "_" + mapList.size(), totalFour.toString());
			totalMap.put(header[7] + "_" + mapList.size(), totalFive.toString());
			totalMap.put(header[8] + "_" + mapList.size(), totalSix.toString());
			totalMap.put(header[9] + "_" + mapList.size(), totalSeven.toString());
			totalMap.put(header[10] + "_" + mapList.size(), totalEight.toString());


			mapList.add(totalMap);
			list.add(mapList);

			// 推荐人业务报表统计时间
			if (StringUtils.isEmpty(startDate)) {
				startDate = "";
			}
			String fileName = "推荐人业务报表(按推荐人)" + startDate + "至" + expirationDate;
			name[0] += expirationDate;
			// 组装excel
			Export.exportDevPremisesInfo(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getDevPremisesExport error: {}", e);
		}
	}

	/**
	 * 客户转换表导出
	 *
	 * @param getCustomerConversionPageReqVo
	 * @return
	 */
	@GetMapping(value = "/getCustomerConversionExport")
	public void getCustomerConversionExport(GetCustomerConversionPageReqVo getCustomerConversionPageReqVo, HttpServletResponse response) {
		try {
//			BaseResponseDTO<GetCustomerConversionExportResDto> resDto = getCustomerConversionExportHander.hander(getCustomerConversionExportReqVo);
			BaseResponseDTO<GetCustomerConversionPageResDto> resDto = getCustomerConversionPageHander.hander(getCustomerConversionPageReqVo);
			Page<CustomerConversionReport> cusPage = resDto.getResData().getPageModel();
			List<CustomerConversionReport> replist = cusPage.getRows();
			// 组装导出数据
			// sheet
			// String[] name = new String[]{"项目客户推荐表", "项目客户转化表"};
			String[] name = new String[] {"项目客户推荐表"};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();

			// 项目客户推荐表
			String[] header = new String[] {"楼盘名称", "报备客户", "报备成功客户", "到访客户", "复访客户", "认筹客户", "认购客户", "直签客户", "签约客户", "已拒收客户","签约率","签约业绩"};
			headerList.add(header);

			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			BigDecimal totalFour = new BigDecimal("0");
			BigDecimal totalFive = new BigDecimal("0");
			BigDecimal totalSix = new BigDecimal("0");
			BigDecimal totalSeven = new BigDecimal("0");
			BigDecimal totalEight = new BigDecimal("0");
			BigDecimal totalNine = new BigDecimal("0");
			BigDecimal totalDealAmount = new BigDecimal("0");
			List<Map<String, String>> mapList = new ArrayList<>();
			for (int i = 0; i < replist.size(); i++) {
				CustomerConversionReport rep = replist.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, rep.getPremisesName());
				String countOne = rep.getCountOne() + "";
				totalOne = totalOne.add(new BigDecimal(countOne));
				map.put(header[1] + "_" + i, countOne);
				String countTwo = rep.getCountTwo() + "";
				totalTwo = totalTwo.add(new BigDecimal(countTwo));
				map.put(header[2] + "_" + i, countTwo);
				String countThree = rep.getCountThree() + "";
				totalThree = totalThree.add(new BigDecimal(countThree));
				map.put(header[3] + "_" + i, countThree);
				String countNine = rep.getCountNine() + "";
				totalNine = totalNine.add(new BigDecimal(countNine));
				map.put(header[4] + "_" + i, countNine);
				String countFour = rep.getCountFour() + "";
				totalFour = totalFour.add(new BigDecimal(countFour));
				map.put(header[5] + "_" + i, countFour);
				String countFive = rep.getCountFive() + "";
				totalFive = totalFive.add(new BigDecimal(countFive));
				map.put(header[6] + "_" + i, countFive);
				String countSeven = rep.getCountSeven() + "";
				totalSeven = totalSeven.add(new BigDecimal(countSeven));
				map.put(header[7] + "_" + i, countSeven);
				String countSix = rep.getCountSix() + "";
				totalSix = totalSix.add(new BigDecimal(countSix));
				map.put(header[8] + "_" + i, countSix);
				String countEight = rep.getCountEight() + "";
				totalEight = totalEight.add(new BigDecimal(countEight));
				map.put(header[9] + "_" + i, countEight);

                String signRate = CalculateUtil.signRate(countTwo,countSix);
                map.put(header[10] + "_" + i, signRate);

                String dealAmount = rep.getDealAmount();
                totalDealAmount = totalDealAmount.add(new BigDecimal(dealAmount));
                map.put(header[11] + "_" + i, dealAmount);

				mapList.add(map);
			}
			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + mapList.size(), "合计");
			totalMap.put(header[1] + "_" + mapList.size(), totalOne.toString());
			totalMap.put(header[2] + "_" + mapList.size(), totalTwo.toString());
			totalMap.put(header[3] + "_" + mapList.size(), totalThree.toString());
			totalMap.put(header[4] + "_" + mapList.size(), totalNine.toString());
			totalMap.put(header[5] + "_" + mapList.size(), totalFour.toString());
			totalMap.put(header[6] + "_" + mapList.size(), totalFive.toString());
			totalMap.put(header[7] + "_" + mapList.size(), totalSeven.toString());
			totalMap.put(header[8] + "_" + mapList.size(), totalSix.toString());
			totalMap.put(header[9] + "_" + mapList.size(), totalEight.toString());
			totalMap.put(header[11] + "_" + mapList.size(), totalDealAmount.toString());
			mapList.add(totalMap);
			list.add(mapList);

			// 项目客户转化表
			String fileName = "楼盘销售情况-" + cusPage.getPageNumber();
			// 组装excel
			Export.exportChannelEffectExcel(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getCustomerConversionExport error: {}", e);
		}
	}
	
	/**
	 * 效果分析表
	 *
	 * @param getEffectPageReqVo
	 * @return
	 */
	@PostMapping(value = "/getEffectPage", produces = "application/json")
	public String getEffectPage(@RequestBody GetEffectPageReqVo getEffectPageReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getEffectPageHander.hander(getEffectPageReqVo));
		} catch (Exception e) {
			logger.error("getEffectPage error: {}", e);
		}
		return null;
	}
	
	/**
	 * 效果分析表导出
	 *
	 * @param getEffectPageReqVo
	 * @return
	 */
	@GetMapping(value = "/getEffectExport")
	public void getEffectExport(GetEffectPageReqVo getEffectPageReqVo, HttpServletResponse response) {
		try {
//			BaseResponseDTO<GetEffectExportResDto> resDto = getEffectExportHander.hander(getEffectExportReqVo);
			if(StringUtils.isNotEmpty(getEffectPageReqVo.getParams().getCompanyName())){
				getEffectPageReqVo.getParams().setCompanyName(URLDecoder.decode(getEffectPageReqVo.getParams().getCompanyName(),"UTF-8"));
			}

			BaseResponseDTO<GetEffectPageResDto> resDto = getEffectPageHander.hander(getEffectPageReqVo);
			Page<ChannelEffectReport> page = resDto.getResData().getPageModel();
			// 组装导出数据
			// sheet
			String[] name = new String[] {"合作机构业绩排名表-"+page.getPageNumber()};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();
			
//			String[] header = new String[] {"合作机构名", "当前经纪人", "累计经纪人", "报备客户", "报备成功客户", "到访客户", "复访客户", "认筹客户", "认购客户", "签约客户","签约率","签约业绩"};
			String[] header = new String[] {"合作机构名", "当前经纪人", "报备客户", "报备成功客户", "到访客户", "复访客户", "认筹客户", "认购客户", "签约客户","签约率","签约业绩"};
			headerList.add(header);
			
			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			BigDecimal totalFour = new BigDecimal("0");
			BigDecimal totalFive = new BigDecimal("0");
			BigDecimal totalSix = new BigDecimal("0");
			BigDecimal totalSeven = new BigDecimal("0");
			BigDecimal totalEight = new BigDecimal("0");
			BigDecimal totalNine = new BigDecimal("0");
			BigDecimal totalDealAmount = new BigDecimal("0");
			List<Map<String, String>> mapList = new ArrayList<>();
			List<ChannelEffectReport> rows = page.getRows();
			for (int i = 0; i < rows.size(); i++) {
				ChannelEffectReport rep = rows.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, rep.getCompanyName());

				String countEight = rep.getCountEight() + "";
				totalEight = totalEight.add(new BigDecimal(countEight));
				map.put(header[1] + "_" + i, countEight);

//				String countSeven = rep.getCountSeven() + "";
//				totalSeven = totalSeven.add(new BigDecimal(countSeven));
//				map.put(header[2] + "_" + i, countSeven);

				String countOne = rep.getCountOne() + "";
				totalOne = totalOne.add(new BigDecimal(countOne));
				map.put(header[2] + "_" + i, countOne);

				String countTwo = rep.getCountTwo() + "";
				totalTwo = totalTwo.add(new BigDecimal(countTwo));
				map.put(header[3] + "_" + i, countTwo);

				String countThree = rep.getCountThree() + "";
				totalThree = totalThree.add(new BigDecimal(countThree));
				map.put(header[4] + "_" + i, countThree);

				String countNine = rep.getCountNine() + "";
				totalNine = totalNine.add(new BigDecimal(countNine));
				map.put(header[5] + "_" + i, countNine);

				String countFour = rep.getCountFour() + "";
				totalFour = totalFour.add(new BigDecimal(countFour));
				map.put(header[6] + "_" + i, countFour);
				String countFive = rep.getCountFive() + "";
				totalFive = totalFive.add(new BigDecimal(countFive));
				map.put(header[7] + "_" + i, countFive);
				String countSix = rep.getCountSix() + "";
				totalSix = totalSix.add(new BigDecimal(countSix));
				map.put(header[8] + "_" + i, countSix);

				String signRate = CalculateUtil.signRate(countTwo,countSix);
				map.put(header[9] + "_" + i,signRate);

				String dealAmount = rep.getDealAmount();
				totalDealAmount = totalDealAmount.add(new BigDecimal(dealAmount));
				map.put(header[10] + "_" + i,dealAmount);

				mapList.add(map);
			}
			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + rows.size(), "合计");
			totalMap.put(header[1] + "_" + rows.size(), totalEight.toString());
//			totalMap.put(header[2] + "_" + rows.size(), totalSeven.toString());
			totalMap.put(header[2] + "_" + rows.size(), totalOne.toString());
			totalMap.put(header[3] + "_" + rows.size(), totalTwo.toString());
			totalMap.put(header[4] + "_" + rows.size(), totalThree.toString());
			totalMap.put(header[5] + "_" + rows.size(), totalNine.toString());
			totalMap.put(header[6] + "_" + rows.size(), totalFour.toString());
			totalMap.put(header[7] + "_" + rows.size(), totalFive.toString());
			totalMap.put(header[8] + "_" + rows.size(), totalSix.toString());
			totalMap.put(header[10] + "_" + rows.size(), totalDealAmount.toString());
			mapList.add(totalMap);
			list.add(mapList);
			String fileName = "合作机构业绩排名表-"+page.getPageNumber();
			// 组装excel
			Export.exportChannelEffectExcel(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getEffectExport error: {}", e);
		}
	}
	
	/**
	 * 获取楼盘所在城市
	 *
	 * @param getPremisesCityListReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesCityList", produces = "application/json")
	public String getPremisesCityList(HttpServletRequest request,@RequestBody GetPremisesCityListReqVo getPremisesCityListReqVo) {
		try {
//			String loginType = getPremisesCityListReqVo.getParams().getLoginType();
//			if (!("5".equals(loginType) || "6".equals(loginType))) {
//				String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//				getPremisesCityListReqVo.getParams().setDomain(domain);
//			}
			return JSONUtil.toJSONStringWithDateFormat(getPremisesCityListHander.hander(getPremisesCityListReqVo));
		} catch (Exception e) {
			logger.error("getPremisesCityList error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取楼盘所在城市
	 * 根据首字母进行分组
	 * @param getPremisesCityGroupListReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesCityGroupList", produces = "application/json")
	public String getPremisesCityGroupList(HttpServletRequest request,@RequestBody GetPremisesCityGroupListReqVo getPremisesCityGroupListReqVo) {
		try {
//			String loginType = getPremisesCityGroupListReqVo.getParams().getLoginType();
//			if (!("5".equals(loginType) || "6".equals(loginType))) {
//				String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//				getPremisesCityGroupListReqVo.getParams().setDomain(domain);
//			}
			return JSONUtil.toJSONStringWithDateFormat(getPremisesCityGroupListHander.hander(getPremisesCityGroupListReqVo));
		} catch (Exception e) {
			logger.error("getPremisesCityGroupList error: {}", e);
		}
		return null;
	}
	
	/**
	 * @param request
	 * @param sendValidateCodeForPwdReqVo
	 * @description 发送重置验证码的短信
	 * @author sangtao
	 * @date 2017/12/1
	 **/
	@Domain
	@PostMapping(value = "/sendValidateCodeForPwd", produces = "application/json")
	public String sendValidateCodeForPwd(HttpServletRequest request, @RequestBody SendValidateCodeForPwdReqVo sendValidateCodeForPwdReqVo) {
		try {
//			String loginType = sendValidateCodeForPwdReqVo.getParams().getLoginType();
//			if (!("5".equals(loginType) || "6".equals(loginType))) {
//				String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//				String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//				sendValidateCodeForPwdReqVo.getParams().setCompanyUuid(companyUuid);
//				sendValidateCodeForPwdReqVo.getParams().setDomain(domain);
//			}

			return JSONUtil.toJSONStringWithDateFormat(sendValidateCodeForPwdHander.hander(sendValidateCodeForPwdReqVo));
		} catch (Exception e) {
			logger.error("sendValidateCodeForPwd error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取楼盘所在城市
	 *
	 * @param request
	 * @param getPremisesGroupByCityReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesGroupByCity", produces = "application/json")
	public String getPremisesGroupByCity(HttpServletRequest request, @RequestBody GetPremisesGroupByCityReqVo getPremisesGroupByCityReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			getPremisesGroupByCityReqVo.getParams().setDomain(domain);
//			getPremisesGroupByCityReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesGroupByCityHander.hander(getPremisesGroupByCityReqVo));
		} catch (Exception e) {
			logger.error("getPremisesGroupByCity error: {}", e);
		}
		return null;
	}
	
	/**
	 * 楼盘删除
	 *
	 * @param request
	 * @param deletePremisesReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/deletePremises", produces = "application/json")
	public String auditPremises(HttpServletRequest request, @RequestBody DeletePremisesReqVo deletePremisesReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			deletePremisesReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(deletePremisesHander.hander(deletePremisesReqVo));
		} catch (Exception e) {
			logger.error("deletePremises error: {}", e);
			return null;
		}
	}
	
	/**
	 * 楼盘列表
	 *
	 * @param request
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesPage", produces = "application/json")
	public String getPremisesPage(HttpServletRequest request, @RequestBody GetPremisesPageReqVo getPremisesPageReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesPageReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesPageHander.hander(getPremisesPageReqVo));
		} catch (Exception e) {
			logger.error("getPremisesPage error: {}", e);
			return null;
		}
	}

	@GetMapping(value = "/exportImportErrorMsg", produces = "application/json")
	@SuppressWarnings("unchecked")
	public String getImportErrorMsg(HttpServletRequest request, HttpServletResponse response, GetImportErrorMsgReqVo reqVo) {
		try {
			BaseResponseDTO<GetImportErrorMsgResDto> resDto = getImportErrorMsgHander.hander(reqVo);
			List<ImportError> impList = resDto.getResData().getImpList();
			if ("1".equals(reqVo.getParams().getImportType())) {
				// 机构
				String[] name = new String[] {"错误信息"}; // sheet
				List<String[]> headerList = new ArrayList<String[]>(); // 表头
				String[] header = new String[] {"部门名称", "部门编号", "备注", "错误信息"};
				headerList.add(header);
				
				List<List<Map<String, String>>> list = new ArrayList<List<Map<String, String>>>(); // 数据
				List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
				for (ImportError imp : impList) {
					Map<String, String> map = new HashMap<String, String>();
					map.put(header[0], imp.getUnitName());
					map.put(header[1], imp.getUnitCode());
					map.put(header[2], imp.getRemark());
					map.put(header[3], imp.getFailure());
					mapList.add(map);
				}
				list.add(mapList);
				
				// 组装excel
				Export.exportExcel(list, headerList, name, response);
			} else if ("2".equals(reqVo.getParams().getImportType())) {
				// 人员
				String[] name = new String[] {"错误信息"}; // sheet
				
				List<String[]> headerList = new ArrayList<String[]>(); // 表头
				String[] header = new String[] {"姓名", "联系电话", "部门名称", "角色名称", "密码", "错误信息"};
				headerList.add(header);
				
				List<List<Map<String, String>>> list = new ArrayList<List<Map<String, String>>>(); // 数据
				List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
				for (ImportError imp : impList) {
					Map<String, String> map = new HashMap<String, String>();
					map.put(header[0], imp.getUserName());
					map.put(header[1], imp.getUserPhone());
					map.put(header[2], imp.getUnitName());
					map.put(header[3], imp.getRoleName());
					map.put(header[4], imp.getPassword());
					map.put(header[5], imp.getFailure());
					mapList.add(map);
				}
				list.add(mapList);
				
				// 组装excel
				Export.exportExcel(list, headerList, name, response);
			}
		} catch (Exception e) {
			logger.error("exportImportErrorMsg error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取已报备的楼盘用户列表
	 *
	 * @return
	 */
	@PostMapping(value = "/getHasCPcusList", produces = "application/json")
	public String getHasCPcusList(@RequestBody GetHasCPcusListReqVo getHasCPcusListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getHasCPcusListHander.hander(getHasCPcusListReqVo));
		} catch (Exception e) {
			logger.error("getHasCPcusList error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取个人报备佣金列表
	 * 
	 * @return
	 */
	@PostMapping(value = "/getPerCPCommissionList", produces = "application/json")
	public String getPerCPCommissionList(@RequestBody GetPerCPCommissionListReqVo getPerCPCommissionListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPerCPCommissionListHander.hander(getPerCPCommissionListReqVo));
		} catch (Exception e) {
			logger.error("getPerCPCommissionList error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 获取佣金规则
	 * @author sangtao
	 * @date 2017/12/4
	 * @param request
	 * @param getCommissionSetPageReqVoDto
	 **/
	@Domain
	@PostMapping(value = "/getCommissionSetPage", produces = "application/json")
	public String getCommissionSetPage(HttpServletRequest request, @RequestBody GetCommissionSetPageReqVo getCommissionSetPageReqVoDto) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getCommissionSetPageReqVoDto.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getCommissionSetPageHander.hander(getCommissionSetPageReqVoDto));
		} catch (Exception e) {
			logger.error("getCommissionSetPage error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 设置规则获取楼盘
	 * @author sangtao
	 * @date 2017/12/5
	 * @param request
	 * @param getPremisesForRuleReqVo
	 **/
	@Domain
	@PostMapping(value = "/getPremisesForRule", produces = "application/json")
	public String getPremisesForRule(HttpServletRequest request, @RequestBody GetPremisesForRuleReqVo getPremisesForRuleReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesForRuleReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesForRuleHander.hander(getPremisesForRuleReqVo));
		} catch (Exception e) {
			logger.error("getPremisesForRule error: {}", e);
		}
		return null;
	}
	
	/**
	 * 新用户注册
	 * 
	 * @param request
	 * @param registReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/regist", produces = "application/json")
	public String regist(HttpServletRequest request, @RequestBody RegistReqVo registReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			registReqVo.getParams().setDomain(domain);
//			registReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(registHander.hander(registReqVo));
		} catch (Exception e) {
			logger.error("regist error: {}", e);
		}
		return null;
	}
	
	/**
	 * 发送注册验证码
	 * 
	 * @param request
	 * @param sendVerificationCodeReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/sendVerificationCode", produces = "application/json")
	public String sendVerificationCode(HttpServletRequest request, @RequestBody SendVerificationCodeReqVo sendVerificationCodeReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			sendVerificationCodeReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(sendVerificationCodeHander.hander(sendVerificationCodeReqVo));
		} catch (Exception e) {
			logger.error("sendVerificationCode error: {}", e);
		}
		return null;
	}
	
	/**
	 * 经纪人发起申诉
	 * 
	 * @author xiaojin.li
	 * @date 2017年12月7日上午11:38:21
	 * @param request
	 * @param addAppealReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/addAppeal", produces = "application/json")
	public String addAppeal(HttpServletRequest request, @RequestBody AddAppealReqVo addAppealReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addAppealHander.hander(addAppealReqVo));
		} catch (Exception e) {
			logger.error("addAppeal error: {}", e);
		}
		return null;
	}
	
	@PostMapping(value = "/initPassword", produces = "application/json")
	public String initPassword(HttpServletRequest request, @RequestBody InitPasswordReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(initPasswordHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("initPassword error: {}", e);
		}
		return null;
	}
	
	/**
	 * 获取分销PC佣金详情等
	 * 
	 * @author xiaojin.li
	 * @date 2017年12月8日上午11:02:42
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@PostMapping(value = "/getCommissionModel", produces = "application/json")
	public String getCommissionModel(HttpServletRequest request, @RequestBody GetCommissionModelReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCommissionModelHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getCommissionModel error: {}", e);
		}
		return null;
	}
	
	@Domain
	@PostMapping(value = "/getAgentPremisesDynamicPage", produces = "application/json")
	public String getAgentPremisesDynamicPage(HttpServletRequest request, @RequestBody GetAgentPremisesDynamicPageReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			reqVo.getParams().setDomain(domain);
//			reqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(getAgentPremisesDynamicPageHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getAgentPremisesDynamicPage error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 获取佣金详情的报备记录
	 * @author sangtao
	 * @date 2017/12/9
	 * @param
	 **/
	@PostMapping(value = "/getSettlementPage", produces = "application/json")
	public String getSettlementPage(HttpServletRequest request, @RequestBody GetSettlementPageReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getSettlementPageHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getSettlementPage error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 佣金规则导出
	 * @author sangtao
	 * @date 2017/12/12
	 * @param
	 **/
	@SuppressWarnings({"unchecked", "unused"})
	@GetMapping(value = "/commissionRuleExport", produces = "application/json")
	public String exportCommissionRule(HttpServletRequest request, HttpServletResponse response, GetCommissionRuleExportReqVo reqVo) {
		try {
			BaseResponseDTO<GetCommissionRuleExportResDto> baseResDto = getCommissionRuleExportHander.hander(reqVo);
			Page<PremisesDto> page = baseResDto.getResData().getPage();
			List<PremisesDto> list = new ArrayList<PremisesDto>();
			if (page != null) {
				list = page.getRows();
			}
			// 若list为空 到处提示语 可设置
			String[] exportName = new String[] {"分销佣金设置列表"}; // sheet
			
			List<String[]> headerList = new ArrayList<String[]>(); // 表头
			String[] header = new String[] {"序号", "楼盘名称", "分销佣金方式", "合作机构", "佣金规则", "生效时间", "创建时间", "分销佣金状态"};
			headerList.add(header);
			List<List<Map<String, String>>> customerList = new ArrayList<List<Map<String, String>>>(); // 数据
			List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			int index = 0;
			for (PremisesDto imp : list) {
				index = index + 1;
				Map<String, String> map2 = new HashMap<String, String>();
				map2.put(header[0], index + "");
				map2.put(header[1], imp.getName());
				map2.put(header[2], imp.getCommissionModeStr());
				map2.put(header[3], imp.getCompanyName());
				map2.put(header[4], imp.getCommissionRuleStr());
				map2.put(header[5], sdf.format(imp.getEffectTime()));
				map2.put(header[6], sdf.format(imp.getCreateTime()));
				if ("1".equals(imp.getState())) {
					map2.put(header[7], "有效");
				} else if ("0".equals(imp.getState())) {
					map2.put(header[7], "无效");
				} else {
					map2.put(header[7], "");
				}
				mapList.add(map2);
			}
			customerList.add(mapList);
			// 组装excel
			Export.exportCommisseionSetDetailExcel("佣金规则", customerList, headerList, exportName, response);
			BaseResponseDTO<GetCommissionRuleExportResDto> responseDTO = new BaseResponseDTO<GetCommissionRuleExportResDto>();
			responseDTO.setResult(baseResDto.getResult());
			return JSONUtil.toJSONStringWithDateFormat(responseDTO);
			
		} catch (Exception e) {
			logger.error("commissionRuleExport error: {}", e);
		}
		return null;
	}
	
	/**
	 * 验证手机号码是否正确
	 * 
	 * @param request
	 * @return 返回 0 错误 1正确
	 */
	@GetMapping(value = "/verifyingMobile")
	public Map<String, String> verifyingMobile(HttpServletRequest request, String mobile) {
		return VerifyingMobile.verifying(mobile);
	}
	
	/**
	 * 根据登录人公司ID获取公司列表
	 * 
	 * @param getPremisesListByCompanyIdReqVo
	 * @return
	 */
	@PostMapping(value = "/getPremisesListByCompanyId", produces = "application/json")
	public String getPremisesListByCompanyId(@RequestBody GetPremisesListByCompanyIdReqVo getPremisesListByCompanyIdReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPremisesListByCompanyIdHander.hander(getPremisesListByCompanyIdReqVo));
		} catch (Exception e) {
			logger.error("getPremisesListByCompanyId error: {}", e);
		}
		return null;
	}
	
	/**
	 * 判断是否M2楼盘
	 * 
	 * @param reqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getChooseM2PremisesFlag", produces = "application/json")
	public String getChooseM2PremisesFlag(HttpServletRequest request, @RequestBody GetChooseM2PremisesFlagReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			reqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getChooseM2PremisesFlagHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getChooseM2PremisesFlag error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 合并部门
	 * @author sangtao
	 * @date 2017/12/20
	 * @param
	 **/
	@Domain
	@PostMapping(value = "/getDeptByCompCode", produces = "application/json")
	public String getDeptByCompCode(HttpServletRequest request, @RequestBody GetDeptByCompCodeReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getDeptByCompCodeHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getDeptByCompCode error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 合并部门
	 * @author sangtao
	 * @date 2017/12/20
	 * @param
	 **/
	@Domain
	@PostMapping(value = "/mergeDept", produces = "application/json")
	public String mergeDept(HttpServletRequest request, @RequestBody MergeDeptReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			reqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(mergeDeptHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("mergeDept error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 转移部门
	 * @author sangtao
	 * @date 2017/12/20
	 * @param
	 **/
	@Domain
	@PostMapping(value = "/changeDept", produces = "application/json")
	public String changeDept(HttpServletRequest request, @RequestBody ChangeDeptReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			reqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(changeDeptHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("changeDept error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 人员调整部门
	 * @author sangtao
	 * @date 2017/12/20
	 * @param
	 **/
	@Domain
	@PostMapping(value = "/userChangeDept", produces = "application/json")
	public String userChangeDept(HttpServletRequest request, @RequestBody UserChangeDeptReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			reqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(userChangeDeptHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("userChangeDept error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 通过手机号获取合作商，分销助手
	 * @author shaopingjiao
	 * @date 2017/12/28
	 * @param
	 **/
	@PostMapping(value = "/getCompanyByPhone", produces = "application/json")
	public String getCompanyByPhone(HttpServletRequest request, @RequestBody GetCompanyByPhoneReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCompanyByPhoneHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getCompanyByPhone error: {}", e);
		}
		return null;
	}
	
	/**
	 * @description 通过手机号获取合作商，案场助手
	 * @author shaopingjiao
	 * @date 2017/12/28
	 * @param
	 **/
	@PostMapping(value = "/getCompanyByAssistantPhone", produces = "application/json")
	public String getCompanyByAssistantPhone(HttpServletRequest request, @RequestBody GetCompanyByPhoneReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getCompanyByAssistantPhoneHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getCompanyByAssistantPhone error: {}", e);
		}
		return null;
	}
	/**
	 * 根据域名判断是否是和M2合作的商户
	 *@author xiaojin.li
	 *@date 2018年1月11日下午2:43:26
	 *@param request
	 *@param reqVo
	 *@return
	 */
	@Domain
	@PostMapping(value = "/isM2Merchant", produces = "application/json")
	public String isM2Merchant(HttpServletRequest request, @RequestBody IsM2MerchantReqVo reqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			reqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(isM2MerchantHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("isM2Merchant error: {}", e);
		}
		return null;
	}
	/**
	 * （4） 开发商楼盘列表
	 *
	 * @param request
	 * @param findPremisesListReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getDevPremisesPage", produces = "application/json")
	public String getDevPremisesPage(HttpServletRequest request, @RequestBody GetDevPremisesPageReqVo findPremisesListReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			findPremisesListReqVo.getParams().setDomain(domain);
//			findPremisesListReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(getDevPremisesPageHander.hander(findPremisesListReqVo));
		} catch (Exception e) {
			logger.error("getDevPremisesPage error: {}", e);
			return null;
		}
	}

	/**
	 * 批量导入合作机构
	 * @param request
	 * @param
	 * @return
	 */
    @Domain
	@PostMapping(value = "/importCooOrg", produces = "application/json")
	public String importCooOrg(MultipartHttpServletRequest request, ImportCooOrgReqVo importCooOrgReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			importCooOrgReqVo.setDomain(domain);
			importCooOrgReqVo.setMulRequest(request);
			return JSONUtil.toJSONStringWithDateFormat(importCooOrgHander.doBusiness(importCooOrgReqVo));
		} catch (Exception e) {
			logger.error("importCooOrg error: {}", e);
			return null;
		}
	}

	/**
	 * 导出‘导入合作机构失败数据’
	 * @param response
	 * @param reqVo
	 * @return
	 */
	@GetMapping(value = "/exportImportCooOrgErrorMsg", produces = "application/json")
	@SuppressWarnings("unchecked")
	public String exportimportCooOrgErrorMsg(HttpServletResponse response, GetImportErrorMsgReqVo reqVo) {
        try {
            BaseResponseDTO<GetImportErrorMsgResDto> resDto = getImportErrorMsgHander.hander(reqVo);
            List<ImportError> impList = resDto.getResData().getImpList();
            String[] name = new String[]{"错误信息"};
            List<String[]> headerList = new ArrayList<>();
            String[] header = new String[]{"公司", "门店", "组别", "地址", "省", "市", "姓名", "手机", "是否管理员", "错误信息"};
            headerList.add(header);

            List<List<Map<String, String>>> dataList = new ArrayList<>();
            List<Map<String, String>> mapList = new ArrayList<>();
            for (ImportError imp : impList) {
                Map<String, String> map = new HashMap<>(16);
                map.put(header[0], imp.getUnitName());
                map.put(header[1], imp.getUnitName2());
                map.put(header[2], imp.getUnitName3());
                map.put(header[3], imp.getAddress());
                map.put(header[4], imp.getProvince());
                map.put(header[5], imp.getCity());
                map.put(header[6], imp.getUserName());
                map.put(header[7], imp.getUserPhone());
                map.put(header[8], imp.getIsAdmin());
                map.put(header[9], imp.getFailure());
                mapList.add(map);
            }
            dataList.add(mapList);
            // 组装excel
            Export.exportExcel(dataList, headerList, name, response);
        } catch (Exception e) {
            logger.error("exportImportCooOrgErrorMsg error: {}", e);
        }
        return null;
    }
	/**
	 * 楼盘批量指定分销商
	 *
	 * @param request
	 * @param batchAssignPremisesAgentReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/batchAssignPremisesAgent", produces = "application/json")
	public String batchAssignPremisesAgent(HttpServletRequest request, @RequestBody BatchAssignPremisesAgentReqVo batchAssignPremisesAgentReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			batchAssignPremisesAgentReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(batchAssignPremisesAgentHander.hander(batchAssignPremisesAgentReqVo));
		} catch (Exception e) {
			logger.error("batchAssignPremisesAgent error: {}", e);
			return null;
		}
	}
	
	/**
	 * 获取开发商分销首页开关
	 *
	 * @param request
	 * @param getAgencyIndexSwitchReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getAgencyIndexSwitch", produces = "application/json")
	public String getAgencyIndexSwitch(HttpServletRequest request, @RequestBody GetAgencyIndexSwitchReqVo getAgencyIndexSwitchReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getAgencyIndexSwitchReqVo.getParams().setDomain(domain);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			getAgencyIndexSwitchReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(getAgencyIndexSwitchHander.hander(getAgencyIndexSwitchReqVo));
		} catch (Exception e) {
			logger.error("getAgencyIndexSwitch error: {}", e);
			return null;
		}
	}
	
	/**
	 * 打开/关闭开发商分销首页开关
	 *
	 * @param request
	 * @param changeAgencyIndexSwitchReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/changeAgencyIndexSwitch", produces = "application/json")
	public String changeAgencyIndexSwitch(HttpServletRequest request, @RequestBody ChangeAgencyIndexSwitchReqVo changeAgencyIndexSwitchReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			String companyUuid = (String)request.getAttribute(ApiConstant.COMPANY_UUID);
//			changeAgencyIndexSwitchReqVo.getParams().setDomain(domain);
//			changeAgencyIndexSwitchReqVo.getParams().setCompanyUuid(companyUuid);
			return JSONUtil.toJSONStringWithDateFormat(changeAgencyIndexSwitchHander.hander(changeAgencyIndexSwitchReqVo));
		} catch (Exception e) {
			logger.error("changeAgencyIndexSwitch error: {}", e);
			return null;
		}
	}


	/**
	 * 根据选择的时间类型获取时间区间
	 * 
	 * @param request
	 * @param reqVo
	 * @return
	 * @throws IOException
	 */
	@PostMapping(value = "/getTimeInterval", produces = "application/json")
	public String getTimeInterval(HttpServletRequest request, @RequestBody GetTimeIntervalReqVo reqVo)
			throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getTimeIntervalHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getTimeInterval error: {}", e);
			return null;
		}
	}
	
	/**
	 * 楼盘流量统计数据
	 * 
	 * @param request
	 * @param reqVo
	 * @return
	 * @throws IOException
	 */
	@PostMapping(value = "/getPremisesFlowList", produces = "application/json")
	public String getPremisesFlowList(HttpServletRequest request, @RequestBody GetPremisesFlowListReqVo reqVo)
			throws IOException {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPremisesFlowListHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getPremisesFlowList error: {}", e);
			return null;
		}
	}
	
	/**
	 * 效果分析表导出
	 *
	 * @param getPremisesFlowExportReqVo
	 * @return
	 */
	@GetMapping(value = "/getPremisesFlowReportExport")
	public void getFlowReportExport(GetPremisesFlowExportReqVo getPremisesFlowExportReqVo, HttpServletResponse response) {
		try {
			BaseResponseDTO<GetPremisesFlowExportResDto> resDto = getPremisesFlowExportHander.hander(getPremisesFlowExportReqVo);
			List<FlowRecordDto> data = resDto.getResData().getData();
			// 组装导出数据
			// sheet
			String[] name = new String[] {"渠道流量分析表"};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();
			
			String[] header = new String[] {"楼盘名称", "关闭量", "点击量", "电话咨询量"};
			headerList.add(header);
			
			List<Map<String, String>> mapList = new ArrayList<>();
			for (int i = 0; i < data.size(); i++) {
				FlowRecordDto frDto = data.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, frDto.getPremisesName());
				map.put(header[1] + "_" + i, frDto.getCloseCount());
				map.put(header[2] + "_" + i, frDto.getClickCount());
				map.put(header[3] + "_" + i, frDto.getTelCount());
				mapList.add(map);
			}
			Map<String, String> firstRowMap = new HashMap<>();
			firstRowMap.put("beginDate", getPremisesFlowExportReqVo.getParams().getBeginDate());
			firstRowMap.put("endDate", getPremisesFlowExportReqVo.getParams().getEndDate());
			list.add(mapList);
			String fileName = "渠道效果分析表";
			// 组装excel
			Export.exportPremisesFlowExcel(firstRowMap, list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getPremisesFlowReportExport error: {}", e);
		}
	}
	
	/**
	 * 批量添加楼盘置业顾问
	 */
	@SuppressWarnings("unchecked")
	@ApiOperation(value="批量添加楼盘置业顾问。")
	@PostMapping(value = "/batchAddEstateAdviser",produces="application/json")
	public BaseResponseDTO<String> batchAddEstateAdviser(@RequestBody @Valid BatchAddEstateAdviserReqVo request,BindingResult bindingResult) {
		return ((BaseResponseDTO<String>) batchAddEstateAdviserHander.hander(request,bindingResult));
	}
	
	@SuppressWarnings("unchecked")
	@ApiOperation(value="根据楼盘id获取置业顾问。")
	@PostMapping(value = "/listEstateAdviserByPremisesId",produces="application/json")
	public BaseResponseDTO<List<EstateAdviserDto>> listEstateAdviserByPremisesId(@RequestBody @Valid ListEstateAdviserByPremisesIdReqVo request,BindingResult bindingResult) {
		return (BaseResponseDTO<List<EstateAdviserDto>>)listEstateAdviserByPremisesIdHandler.hander(request, bindingResult);
	}
	
	/**
	 * 首付金录入
	 * @return
	 */
	@ApiOperation(value="首付金录入")
	@PostMapping(value="/updateFirstPayment")
	public String updateFirstPayment(@RequestBody @Valid AddFirstPaymentVo reqVo){
		return JSONUtil.toJSONStringWithDateFormat(addFirstPaymentHander.hander(reqVo));
	}
	
	@ApiOperation(value="通过报备id获取首付金录入信息")
	@PostMapping(value="/getFirstPayment")
	public String getInputDownPayment(@RequestBody @Valid GetFirstPaymentReqVo reqVo) {
		return JSONUtil.toJSONStringWithDateFormat(getFirstPaymentHander.hander(reqVo));
	}

	@Domain
	@ApiOperation(value="获取驻场人员列表信息")
	@PostMapping(value="/getPremisesCMSmsList")
	public String getInputDownPayment(@RequestBody @Valid GetPremisesCMSmsListReqVo reqVo,HttpServletRequest request) {
//		String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//		String companyUuid = (String)request.getHeader(ApiConstant.COMPANY_UUID);
//		reqVo.getParams().setDomain(domain);
//		reqVo.getParams().setCompanyUuid(companyUuid);

		return JSONUtil.toJSONStringWithDateFormat(getPremisesCMSmsListHander.hander(reqVo));
	}

	@ApiOperation(value="设置案场人员是否发送短信")
	@PostMapping(value="/updateCaseMember")
	@ForbidRepeatClick
	public String updateCaseMember(@RequestBody @Valid UpdateCaseMemberReqVo reqVo) {
		return JSONUtil.toJSONStringWithDateFormat(updateCaseMemberHander.hander(reqVo));
	}

	@ApiOperation(value="门店效果分析表")
	@PostMapping(value="/getStoreReport")
	public String getStoreReport(@RequestBody GetStoreReportPageReqVo reqVo){
		return  JSONUtil.toJSONStringWithDateFormat(getStoreReportPageHander.hander(reqVo));
	}

	@ApiOperation(value="组别效果分析表")
	@PostMapping(value="/getGroupReport")
	public String getGroupReport(@RequestBody GetGroupReportPageReqVo reqVo){
		return  JSONUtil.toJSONStringWithDateFormat(getGroupReportHander.hander(reqVo));
	}
	@ApiOperation(value="获取门店下的组别")
	@PostMapping(value="/getStoreByOrg")
	public String getGroupByStore(@RequestBody GetDeptListReqVo reqVo){
		return  JSONUtil.toJSONStringWithDateFormat(getDeptListHander.hander(reqVo));
	}
	@Domain
	@ApiOperation(value="获取经纪人业绩")
	@PostMapping(value="/getAgentReport")
	public String getAgentReport(HttpServletRequest request,@RequestBody GetAgentReportPageReqVo reqVo){
		return  JSONUtil.toJSONStringWithDateFormat(getAgentReportHander.hander(reqVo));
	}

	//报表导出功能

	/**
	 * 机构门店导出功能
	 * @param getStoreReportPageReqVo
	 * @param response
	 */
	@GetMapping(value = "/getStoreReportExport")
	public void getStoreReportExport(HttpServletRequest request,GetStoreReportPageReqVo getStoreReportPageReqVo, HttpServletResponse response) {
		try {
			BaseResponseDTO<GetStoreReportPageResDto> resDto = getStoreReportPageHander.hander(getStoreReportPageReqVo);
			Page<ChannelEffectReport> page = resDto.getResData().getPageModel();
			// 组装导出数据
			// sheet
			String[] name = new String[] {"机构门店业绩排名表-"+page.getPageNumber()};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();

			String[] header = new String[] {"门店", "当前经纪人", "累计经纪人", "报备客户", "报备成功客户", "到访客户", "认筹客户", "认购客户", "签约客户","签约率","签约业绩(元)"};
			headerList.add(header);

			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			BigDecimal totalFour = new BigDecimal("0");
			BigDecimal totalFive = new BigDecimal("0");
			BigDecimal totalSix = new BigDecimal("0");
			BigDecimal totalSeven = new BigDecimal("0");
			BigDecimal totalEight = new BigDecimal("0");
			BigDecimal totalDealAmount = new BigDecimal("0");
			List<Map<String, String>> mapList = new ArrayList<>();
			List<ChannelEffectReport> rows = page.getRows();
			for (int i = 0; i < rows.size(); i++) {
				ChannelEffectReport rep = rows.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, rep.getCompanyName());

				String countEight = rep.getCountEight() + "";
				totalEight = totalEight.add(new BigDecimal(countEight));
				map.put(header[1] + "_" + i, countEight);

				String countSeven = rep.getCountSeven() + "";
				totalSeven = totalSeven.add(new BigDecimal(countSeven));
				map.put(header[2] + "_" + i, countSeven);

				String countOne = rep.getCountOne() + "";
				totalOne = totalOne.add(new BigDecimal(countOne));
				map.put(header[3] + "_" + i, countOne);
				String countTwo = rep.getCountTwo() + "";
				totalTwo = totalTwo.add(new BigDecimal(countTwo));
				map.put(header[4] + "_" + i, countTwo);
				String countThree = rep.getCountThree() + "";
				totalThree = totalThree.add(new BigDecimal(countThree));
				map.put(header[5] + "_" + i, countThree);
				String countFour = rep.getCountFour() + "";
				totalFour = totalFour.add(new BigDecimal(countFour));
				map.put(header[6] + "_" + i, countFour);
				String countFive = rep.getCountFive() + "";
				totalFive = totalFive.add(new BigDecimal(countFive));
				map.put(header[7] + "_" + i, countFive);
				String countSix = rep.getCountSix() + "";
				totalSix = totalSix.add(new BigDecimal(countSix));
				map.put(header[8] + "_" + i, countSix);

				String signRate = CalculateUtil.signRate(countTwo,countSix);
				map.put(header[9] + "_" + i,signRate);

				String dealAmount = rep.getDealAmount();
				totalDealAmount = totalDealAmount.add(new BigDecimal(dealAmount));
				map.put(header[10] + "_" + i,dealAmount);

				mapList.add(map);
			}
			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + rows.size(), "合计");
			totalMap.put(header[1] + "_" + rows.size(), totalEight.toString());
			totalMap.put(header[2] + "_" + rows.size(), totalSeven.toString());
			totalMap.put(header[3] + "_" + rows.size(), totalOne.toString());
			totalMap.put(header[4] + "_" + rows.size(), totalTwo.toString());
			totalMap.put(header[5] + "_" + rows.size(), totalThree.toString());
			totalMap.put(header[6] + "_" + rows.size(), totalFour.toString());
			totalMap.put(header[7] + "_" + rows.size(), totalFive.toString());
			totalMap.put(header[8] + "_" + rows.size(), totalSix.toString());
			totalMap.put(header[10] + "_" + rows.size(), totalDealAmount.toString());
			mapList.add(totalMap);
			list.add(mapList);
			String fileName = "机构门店业绩排名表-"+page.getPageNumber();
			// 组装excel
			Export.exportChannelEffectExcel(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getStoreReportExport error: {}", e);
		}
	}


	/**
	 * 机构组别导出功能
	 * @param getGroupReportPageReqVo
	 * @param response
	 */
	@GetMapping(value = "/getGroupReportExport")
	public void getGroupReportExport(GetGroupReportPageReqVo getGroupReportPageReqVo, HttpServletResponse response) {
		try {
			if(StringUtils.isNotEmpty(getGroupReportPageReqVo.getParams().getStoreName())){
				getGroupReportPageReqVo.getParams().setStoreName(URLDecoder.decode(getGroupReportPageReqVo.getParams().getStoreName(),"UTF-8"));
			}
			BaseResponseDTO<GetGroupReportPageResDto> resDto = getGroupReportHander.hander(getGroupReportPageReqVo);
			Page<ChannelEffectReport> page = resDto.getResData().getPageModel();
			// 组装导出数据
			// sheet
			String[] name = new String[] {"机构组别业绩排名表-"+page.getPageNumber()};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();

			String[] header = new String[] {"组别名", "当前经纪人", "累计经纪人", "报备客户", "报备成功客户", "到访客户", "认筹客户", "认购客户", "签约客户","签约率","签约业绩(元)"};
			headerList.add(header);

			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			BigDecimal totalFour = new BigDecimal("0");
			BigDecimal totalFive = new BigDecimal("0");
			BigDecimal totalSix = new BigDecimal("0");
			BigDecimal totalSeven = new BigDecimal("0");
			BigDecimal totalEight = new BigDecimal("0");
			BigDecimal totalNine = new BigDecimal("0");
			BigDecimal totalDealAmount = new BigDecimal("0");
			List<Map<String, String>> mapList = new ArrayList<>();
			List<ChannelEffectReport> rows = page.getRows();
			if(null != rows || rows.size() > 0){
				for (int i = 0; i < rows.size(); i++) {
					ChannelEffectReport rep = rows.get(i);
					Map<String, String> map = new HashMap<>();
					map.put(header[0] + "_" + i, rep.getCompanyName());

					String countEight = rep.getCountEight() + "";
					totalEight = totalEight.add(new BigDecimal(countEight));
					map.put(header[1] + "_" + i, countEight);

					String countSeven = rep.getCountSeven() + "";
					totalSeven = totalSeven.add(new BigDecimal(countSeven));
					map.put(header[2] + "_" + i, countSeven);

					String countOne = rep.getCountOne() + "";
					totalOne = totalOne.add(new BigDecimal(countOne));
					map.put(header[3] + "_" + i, countOne);
					String countTwo = rep.getCountTwo() + "";
					totalTwo = totalTwo.add(new BigDecimal(countTwo));
					map.put(header[4] + "_" + i, countTwo);
					String countThree = rep.getCountThree() + "";
					totalThree = totalThree.add(new BigDecimal(countThree));
					map.put(header[5] + "_" + i, countThree);
					String countFour = rep.getCountFour() + "";
					totalFour = totalFour.add(new BigDecimal(countFour));
					map.put(header[6] + "_" + i, countFour);
					String countFive = rep.getCountFive() + "";
					totalFive = totalFive.add(new BigDecimal(countFive));
					map.put(header[7] + "_" + i, countFive);
					String countSix = rep.getCountSix() + "";
					totalSix = totalSix.add(new BigDecimal(countSix));
					map.put(header[8] + "_" + i, countSix);

					String signRate = CalculateUtil.signRate(countTwo,countSix);
					String signR = signRate.substring(0, signRate.length() - 1);
					totalNine = totalNine.add(new BigDecimal(signR));
					map.put(header[9] + "_" + i,signRate);

					String dealAmount = rep.getDealAmount();
					totalDealAmount = totalDealAmount.add(new BigDecimal(dealAmount));
					map.put(header[10] + "_" + i,dealAmount);

					mapList.add(map);
				}
			}

			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + rows.size(), "合计");
			totalMap.put(header[1] + "_" + rows.size(), totalEight.toString());
			totalMap.put(header[2] + "_" + rows.size(), totalSeven.toString());
			totalMap.put(header[3] + "_" + rows.size(), totalOne.toString());
			totalMap.put(header[4] + "_" + rows.size(), totalTwo.toString());
			totalMap.put(header[5] + "_" + rows.size(), totalThree.toString());
			totalMap.put(header[6] + "_" + rows.size(), totalFour.toString());
			totalMap.put(header[7] + "_" + rows.size(), totalFive.toString());
			totalMap.put(header[8] + "_" + rows.size(), totalSix.toString());
			totalMap.put(header[9] + "_" + rows.size(), totalNine.toString()+"%");
			totalMap.put(header[10] + "_" + rows.size(), totalDealAmount.toString());
			mapList.add(totalMap);
			list.add(mapList);
			String fileName = "机构组别业绩排名表-"+page.getPageNumber();
			// 组装excel
			Export.exportChannelEffectExcel(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getGroupReportExport error: {}", e);
		}
	}

	/**
	 * 导出经纪人报表
	 * @param getAgentReportPageReqVo
	 * @param response
	 */
	@GetMapping(value = "/getAgentReportExport")
	@Domain
	public void getAgentReportExport(GetAgentReportPageReqVo getAgentReportPageReqVo, HttpServletResponse response) {
		try {
			BaseResponseDTO<GetAgentReportPageResDto> resDto = getAgentReportHander.hander(getAgentReportPageReqVo);
			Page<ChannelEffectReport> page = resDto.getResData().getPageModel();
			// 组装导出数据
			// sheet
			String[] name = new String[] {"经纪人业绩排名表-"+page.getPageNumber()};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();

			String[] header = new String[] {"经纪人名", "报备客户", "报备成功客户", "到访客户", "认筹客户", "认购客户", "签约客户","签约率","签约业绩（元）"};
			headerList.add(header);

			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			BigDecimal totalFour = new BigDecimal("0");
			BigDecimal totalFive = new BigDecimal("0");
			BigDecimal totalSix = new BigDecimal("0");
			BigDecimal totalSeven = new BigDecimal("0");
			BigDecimal totalDealAmount = new BigDecimal("0");
			List<Map<String, String>> mapList = new ArrayList<>();
			List<ChannelEffectReport> rows = page.getRows();
			for (int i = 0; i < rows.size(); i++) {
				ChannelEffectReport rep = rows.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, rep.getName());

				String countOne = rep.getCountOne() + "";
				totalOne = totalOne.add(new BigDecimal(countOne));
				map.put(header[1] + "_" + i, countOne);
				String countTwo = rep.getCountTwo() + "";
				totalTwo = totalTwo.add(new BigDecimal(countTwo));
				map.put(header[2] + "_" + i, countTwo);
				String countThree = rep.getCountThree() + "";
				totalThree = totalThree.add(new BigDecimal(countThree));
				map.put(header[3] + "_" + i, countThree);
				String countFour = rep.getCountFour() + "";
				totalFour = totalFour.add(new BigDecimal(countFour));
				map.put(header[4] + "_" + i, countFour);
				String countFive = rep.getCountFive() + "";
				totalFive = totalFive.add(new BigDecimal(countFive));
				map.put(header[5] + "_" + i, countFive);
				String countSix = rep.getCountSix() + "";
				totalSix = totalSix.add(new BigDecimal(countSix));
				map.put(header[6] + "_" + i, countSix);

				String signRate = CalculateUtil.signRate(countTwo,countSix);
				String signR = signRate.substring(0, signRate.length() - 1);
                totalSeven = totalSeven.add(new BigDecimal(signR));
				map.put(header[7] + "_" + i,signRate);

				String dealAmount = rep.getDealAmount();
				totalDealAmount = totalDealAmount.add(new BigDecimal(dealAmount));
				map.put(header[8] + "_" + i,dealAmount);

				mapList.add(map);
			}
			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + rows.size(), "合计");
			totalMap.put(header[1] + "_" + rows.size(), totalOne.toString());
			totalMap.put(header[2] + "_" + rows.size(), totalTwo.toString());
			totalMap.put(header[3] + "_" + rows.size(), totalThree.toString());
			totalMap.put(header[4] + "_" + rows.size(), totalFour.toString());
			totalMap.put(header[5] + "_" + rows.size(), totalFive.toString());
			totalMap.put(header[6] + "_" + rows.size(), totalSix.toString());
			totalMap.put(header[7] + "_" + rows.size(), totalSeven.toString()+"%");
			totalMap.put(header[8] + "_" + rows.size(), totalDealAmount.toString());
			mapList.add(totalMap);
			list.add(mapList);
			String fileName = "经纪人业绩排名表-"+page.getPageNumber();
			// 组装excel
			Export.exportChannelEffectExcel(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("getAgentReportExport error: {}", e);
		}
	}

	@ApiOperation(value="获取短信记录")
	@Domain
	@PostMapping(value="/getSmsReport")
	public String getSmsReport(@RequestBody SmsReportPageReqVo reqVo,HttpServletRequest request){
//		String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//		String companyUuid = (String)request.getHeader(ApiConstant.COMPANY_UUID);
//		reqVo.getParams().setDomain(domain);
//		reqVo.getParams().setCompanyUuid(companyUuid);
		return  JSONUtil.toJSONStringWithDateFormat(smsReportPageHander.hander(reqVo));
	}

	/**
	 * 机构组别导出功能
	 * @param reqVo
	 * @param response
	 * @param request
	 */
	@GetMapping(value = "/getSmsReportExport")
	public void getGroupReportExport(SmsReportPageReqVo reqVo, HttpServletResponse response,HttpServletRequest request) {
		try{
			BaseResponseDTO<SmsReportPageResDto> baseResponseDto = smsReportExportHander.hander(reqVo);
			Export.exportSmsHistory(baseResponseDto.getResData().getPage().getRows(),reqVo.getParams(),baseResponseDto.getResData().getCompanyName(),response);
		}catch (Exception e){
			logger.error("getSmsReportExport error: {}", e);
		}
	}

	/**
	 * （16） 楼盘详情
	 *
	 * @param request
	 * @param getPremisesDetailReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getSharePremisesDetail", produces = "application/json")
	public String getSharePremisesDetail(HttpServletRequest request, @RequestBody GetPremisesDetailReqVo getPremisesDetailReqVo) {
		try {
//			String domain = (String)request.getAttribute(ApiConstant.DOMAIN);
//			getPremisesDetailReqVo.getParams().setDomain(domain);
			return JSONUtil.toJSONStringWithDateFormat(getPremisesDetailHander.hander(getPremisesDetailReqVo));
		} catch (Exception e) {
			logger.error("getPremisesDetail error: {}", e);
			return null;
		}
	}

	/**
	 * 案场助手获取一级机构信息
	 * @param getOrgAssistantListReqVo
	 * @return
	 */
	@PostMapping(value = "/getOrgAssistantList", produces = "application/json")
	public String GetOrgAssistantList(@RequestBody GetOrgAssistantListReqVo getOrgAssistantListReqVo){
		try{
			return JSONUtil.toJSONStringWithDateFormat(getOrgAssistantListHander.hander(getOrgAssistantListReqVo));
		}catch (Exception e){
			logger.error("getPremisesDetail error: {}", e);
			return null;
		}
	}

    /**
     * 楼盘排序（置顶、上移、下移）
     * @auth guifang.weng
     * @date 2019年2月19日14:31:45
     * @param setPremisesOrderReqVo
     * @return
     */
    @PostMapping(value = "/setPremisesOrder", produces = "application/json")
	public String setPremisesOrder(@RequestBody SetPremisesOrderReqVo setPremisesOrderReqVo) {
	    try {
	        return JSONUtil.toJSONStringWithDateFormat(setPremisesOrderHander.hander(setPremisesOrderReqVo));
        } catch (Exception e) {
	        logger.error("setPremisesOrder error: {}", e);
	        return null;
        }
    }

	@ApiOperation(value="添加报备模板")
	@PostMapping(value="/addReportModel")
	public String addReportModel(@RequestBody EditReportModelReqVo reqVo) {
		return JSONUtil.toJSONStringWithDateFormat(editReportModelHander.hander(reqVo));
	}
	@ApiOperation(value="删除报备模板")
	@PostMapping(value="/deleteReportModel")
	public String deleteReportModel(@RequestBody DeleteReportModelReqVo reqVo) {
		return JSONUtil.toJSONStringWithDateFormat(deleteReportModelHander.hander(reqVo));
	}
	@ApiOperation(value="获取报备模板列表")
	@PostMapping(value="/getReportModelList")
	public String getReportModelList(@RequestBody GetReportModelListReqVo reqVo) {
		return JSONUtil.toJSONStringWithDateFormat(getReportModelListHander.hander(reqVo));
	}

	//获取报备模板详细信息
	@ApiOperation(value="获取报备详细信息列表")
	@PostMapping(value="/getReportModelInfoList")
	public String getReportModelInfoList(@RequestBody GetReportModelInfoListReqVo reqVo) {
		return JSONUtil.toJSONStringWithDateFormat(getReportModelInfoListHander.hander(reqVo));
	}
    @ApiOperation(value="移动报备模板")
    @PostMapping(value="/moveReportModelOrder")
	public String moveReportModelOrderHander(@RequestBody MoveReportModelOrderReqVo reqVo) {
		return JSONUtil.toJSONStringWithDateFormat(moveReportModelOrderHander.hander(reqVo));
	}
	@PostMapping(value = "/importCusPre", produces = "application/json")
	public String importCusPre(MultipartHttpServletRequest request, String userId) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(importCusPreHander.doBusiness(request, userId));
		} catch (Exception e) {
			logger.error("import customer premises error: {}", e);
			return null;
		}
	}

	@PostMapping(value = "/addBatchCusPre", produces = "application/json")
	public String addBatchCusPre(@RequestBody AddBatchCusPreReqVo requestVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addBatchCusPreHander.doBusiness(requestVo));
		} catch (Exception e) {
			logger.error("add batch customer premises error: {}", e);
			return null;
		}
	}

	@SuppressWarnings("unchecked")
	@GetMapping(value = "/exportBatchImpError", produces = "application/json")
	public void exportBatchImpError(HttpServletRequest request, HttpServletResponse response, ExportBatchImpErrorReqVo reqVo) {
		try {
			BaseResponseDTO<ExportBatchImpErrorResDto> baseResDto = exportBatchImpErrorHander.doBusiness(reqVo);
			ExportBatchImpErrorResDto resDto = baseResDto.getResData();

			String[] header = new String[] {"经纪人姓名", "经纪人手机", "客户姓名", "客户手机号", "客户性别", "错误信息"};

			// 组装excel
			Export.exportBatchImpError(resDto.getErrorJson(), header, response);
		} catch (Exception e) {
			logger.error("exportPartner error: {}", e);
		}
	}

	@PostMapping(value = "/batchUpdateReportModel", produces = "application/json")
	public String batchUpdateReportModel(@RequestBody BatchUpdateReportModelReqVo requestVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(batchUpdateReportModelHander.doBusiness(requestVo));
		} catch (Exception e) {
			logger.error("add batch report model error: {}", e);
			return null;
		}
	}

	@PostMapping(value = "/getReportModelContent", produces = "application/json")
	public String getReportModelContent(@RequestBody GetReportModelContentReqVo requestVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getReportModelContentHander.doBusiness(requestVo));
		} catch (Exception e) {
			logger.error("get premises report model config error: {}", e);
			return null;
		}
	}

    /**
     * 校验楼盘名称是否重复
     * @param requestVo
     * @return
     */
    @PostMapping(value = "/checkPremisesName", produces = "application/json")
    public String checkPremisesName(@RequestBody CheckPremisesNameReqVo requestVo) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(checkPremisesNameHander.doBusiness(requestVo));
        } catch (Exception e) {
            logger.error("checkPrimisesName error: {}", e);
            return null;
        }
    }
	/**
	 * 设置楼盘主推状态
	 * @param requestVo
	 * @return
	 */
	@PostMapping(value = "/setMainPushPremises", produces = "application/json")
	public String setMainPushPremises(@RequestBody SetMainPushPremisesReqVo requestVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(setMainPushPremisesHander.doBusiness(requestVo));
		} catch (Exception e) {
			logger.error("set premises main push  error: {}", e);
			return null;
		}
	}

	/**
	 * 获取渠道角色资源
	 * @param requestVo
	 * @return
	 */
	@PostMapping(value = "/getAuthorizeRoleListForDevelop", produces = "application/json")
	public String getAuthorizeRoleListForDevelop(@RequestBody GetAuthorizeRoleListReqVo requestVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAuthorizeRoleListForDevelopHander.doBusiness(requestVo));
		} catch (Exception e) {
			logger.error("set premises main push  error: {}", e);
			return null;
		}
	}
    @ApiOperation(value = "获得楼盘动态", response = GetPremisesDynamicResDto.class)
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "GetPremisesDynamicReqVo") })
    @PostMapping(value = "/getPremisesDynamicList", produces = "application/json")
    public String getPremisesDynamic(@RequestBody GetPremisesDynamicReqVo reqVo) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(getPremisesDynamicHander.hander(reqVo));
        } catch (Exception e) {
            logger.error("getPremisesDynamicList error: {}", e);
            return null;
        }
    }

    @Domain
    @ApiOperation(value = "获取楼盘分类统计", response = PremisesTypeCountResDto.class)
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "GeneralReqVo") })
    @PostMapping(value = "/premisesTypeCount", produces = "application/json")
    public String premisesTypeCount(@RequestBody GeneralReqVo<CommonReqDTO> reqVo) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(premisesTypeCountHander.hander(reqVo));
        } catch (Exception e) {
            logger.error("premisesTypeCount error: {}", e);
            return null;
        }
    }

    @ApiOperation(value = "根据楼盘ID获取图片", response = PremisesTypeCountResDto.class)
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "GeneralReqVo") })
    @PostMapping(value = "/selectPremisesImageList", produces = "application/json")
    public String selectPremisesImageList(@RequestBody SetMainPushPremisesReqVo requestVo) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(selectPremisesImageListHander.hander(requestVo));
        } catch (Exception e) {
            logger.error("selectPremisesImageList error: {}", e);
            return null;
        }
    }

    @ApiOperation(value = "编辑报备客户信息")
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "EditCustomerInfoReqVo") })
    @PostMapping(value = "/editCustomerInfo", produces = "application/json")
    public String editCustomerInfo(@RequestBody EditCustomerInfoReqVo requestVo) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(editCustomerInfoHander.hander(requestVo));
        } catch (Exception e) {
            logger.error("editCustomerInfo error: {}", e);
            return null;
        }
    }

	@ApiOperation(value = "新增/编辑报备客户扩展信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "AddOrEditCustomerInfoReqVo") })
	@PostMapping(value = "/addOrEditCustomerInfo", produces = "application/json")
	public String addOrEditCustomerInfo(@RequestBody AddOrEditCustomerInfoReqVo requestVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addOrEditCustomerInfoHander.hander(requestVo));
		} catch (Exception e) {
			logger.error("addOrEditCustomerInfoHander error: {}{}", e);
			return null;
		}
	}

	@ApiOperation(value = "获取公司信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "GetCompanyInfoReqVo") })
	@PostMapping(value = "/getCompanyInfo", produces = "application/json")
	@Domain
    public String getCompanyInfo(@RequestBody GetCompanyInfoReqVo requestVo,HttpServletRequest request){
		try{
			return JSONUtil.toJSONStringWithDateFormat(getCompanyInfoHander.hander(requestVo));
		}catch (Exception e){
			logger.error("GetCompanyInfo error: {}", e);
			return null;
		}
	}
    /**
     * BOSS看板
     * @param reqVo
     * @return
     */
    @ApiOperation(value = "BOSS看板TOP", response = BossBordResDto.class)
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "BossBordReqVo") })
    @PostMapping(value = "/bossBord", produces = "application/json")
    @Domain
    public String bossBord(@RequestBody BossBordReqVo reqVo,HttpServletRequest request) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(bossBordHander.hander(reqVo));
        } catch (Exception e) {
            logger.error("bossBord error: {}", e);
            return null;
        }
    }

    /**
     * 楼盘销售业绩分页列表
     * @param reqVo
     * @return
     */
    @ApiOperation(value = "楼盘销售业绩分页列表", response = HouseSalePerformancePageListResDto.class)
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "HouseSalePerformancePageListReqVo") })
		@PostMapping(value = "/houseSalePerformancePageList", produces = "application/json")
    @Domain
    public String houseSalePerformancePageList(@RequestBody HouseSalePerformancePageListReqVo reqVo,HttpServletRequest request) {
	    try {
	        return JSONUtil.toJSONStringWithDateFormat(houseSalePerformancePageListHander.hander(reqVo));
        } catch (Exception e) {
	        logger.error("houseSalePerformancePageList error: {}", e);
	        return null;
        }
    }

    /**
     * 机构销售业绩分页列表
     * @param reqVo
     * @return
     */
    @ApiOperation(value = "机构销售业绩分页列表", response = OrganSalePerformancePageListResDto.class)
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "OrganSalePerformancePageListReqVo") })
    @PostMapping(value = "/organSalePerformancePageList", produces = "application/json")
    @Domain
    public String organSalePerformancePageList(@RequestBody OrganSalePerformancePageListReqVo reqVo,HttpServletRequest request) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(organSalePerformancePageListHander.hander(reqVo));
        } catch (Exception e) {
            logger.error("organSalePerformancePageList error: {}", e);
            return null;
        }
    }
    /**
     * 获取部门关系（分销助手）
     * @param reqVo
     * @return
     */
    @ApiOperation(value = "获取部门关系", response = GetParentDeptResDto.class)
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "GetParentDeptReqVo") })
    @PostMapping(value = "/getParentDept", produces = "application/json")
    @Domain
    public String getParentDept(@RequestBody GetParentDeptReqVo reqVo,HttpServletRequest request) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(getParentDeptHander.hander(reqVo));
        } catch (Exception e) {
            logger.error("getParentDept error: {}", e);
            return null;
        }
    }

    /**
     * 获取市区列表（含该区楼盘统计）
     *
     * @param getAreaAndPremisesCountReqVo
     * @return
     */
    @Domain
    @PostMapping(value = "/getAreaAndPremisesCount", produces = "application/json")
    public String getAreaAndPremisesCount(HttpServletRequest request, @RequestBody GetAreaAndPremisesCountReqVo getAreaAndPremisesCountReqVo) {
        try {

            return JSONUtil.toJSONStringWithDateFormat(getAreaAndPremisesCountHander.hander(getAreaAndPremisesCountReqVo));
        } catch (Exception e) {
            logger.error("getAreaAndPremisesCount error: {}", e);
        }
        return null;
    }

	/**
	 * 获取微信模板消息列表
	 * @param getWxModelSetListReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getWeiXinModelList", produces = "application/json")
	public String getWeiXinModelList(HttpServletRequest request, @RequestBody GetWxModelSetListReqVo getWxModelSetListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getWxMsgModelHander.hander(getWxModelSetListReqVo));
		} catch (Exception e) {
			logger.error("getAreaAndPremisesCount error: {}", e);
		}
		return null;
	}

	/**
	 * 复用短信设置给微信模板消息
	 * @param request
	 * @param weixinMsgPushSettingReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/reuseSmsSetting", produces = "application/json")
	public String getWeiXinModelList(HttpServletRequest request, @RequestBody WeixinMsgPushSettingReqVo weixinMsgPushSettingReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(reuseSmsSettingHander.hander(weixinMsgPushSettingReqVo));
		} catch (Exception e) {
			logger.error("getAreaAndPremisesCount error: {}", e);
		}
		return null;
	}
	/**
	 * 设置微信模板消息推送开关
	 * @param request
	 * @param changeWeixinModelSettingReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/changeWeixinModelSetting", produces = "application/json")
	public String getWeiXinModelList(HttpServletRequest request, @RequestBody ChangeWeixinModelSettingReqVo changeWeixinModelSettingReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(changeWeixinModelSettingHander.hander(changeWeixinModelSettingReqVo));
		} catch (Exception e) {
			logger.error("getAreaAndPremisesCount error: {}", e);
		}
		return null;
	}

	/**
	 * 设置微信模板消息推送开关
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/sendFailureWxmsgAgain", produces = "application/json")
	public String sendFailureWxmsgAgain(HttpServletRequest request, @RequestBody SendFailureWxmsgAgainReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(sendFailureWxmsgAgainHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("sendFailureWxmsgAgain error: {}", e);
		}
		return null;
	}

	/**
	 * 逾期设置
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/overdueDecisionConfig", produces = "application/json")
	public String overdueDecisionConfig(HttpServletRequest request, @RequestBody OverdueDecisionConfigReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(overdueDecisionConfigHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("overdueDecisionConfig error: {}", e);
		}
		return null;
	}
	/**
	 * 获取楼盘逾期设置
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getOverdueConfigInfo", produces = "application/json")
	public String getOverdueConfigInfo(HttpServletRequest request, @RequestBody GetOverdueConfigInfoReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getOverdueConfigInfoHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("getOverdueConfigInfo error: {}", e);
		}
		return null;
	}

	/**
	 * 交易状态变更
	 * @method: getTradeStatusChange
	 * @param: [reqvo]
	 * @return: java.lang.String
	 */
	@Domain
	@PostMapping(value = "/getTradeStatusChange", produces = "application/json")
	public String getTradeStatusChange(@RequestBody GetTradeStatusChangeReqVo reqvo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getTradeStatusChangeHander.hander(reqvo));
		} catch (Exception e) {
			logger.error("getTradeStatusChange error: {}", e);
		}
		return null;
	}

    /**
     * M2相关接口
     * 1、选择M2楼盘
     * 2、校验M2客户信息(是否存在)
     * 3、推送客户至M2
     */
    @ApiOperation(value = "獲取M2樓盤接口", response = GetPremisesDynamicResDto.class)
    @PostMapping(value = "/getM2Projects", produces = "application/json")
    @ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "GetM2ProjectsReqVo") })
    public BaseResponseDTO<GetM2ProjectsResDto> getM2Projects(HttpServletRequest request, @RequestBody GetM2ProjectsReqVo reqVo){
        return (BaseResponseDTO<GetM2ProjectsResDto>) getM2ProjectsHander.hander(reqVo);
    }

    @ApiOperation(value = "校验报备用户报备保护时间", response = CheckReportProtectResDto.class)
    @ApiImplicitParams({@ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "CheckReportProtectReqVo")})
    @PostMapping(value = "/checkReportProtect", produces = MediaType.APPLICATION_JSON_VALUE)
    public String checkReportProtect(@RequestBody CheckReportProtectReqVo  reqVo) {
        try {
            return JSONUtil.toJSONStringWithDateFormat(checkReportProtectHander.hander(reqVo));
        } catch (Exception e) {
            logger.error("checkReportProtect error: {}", e);
        }
        return null;
    }

	/**
	 */
	@ApiOperation(value = "redisOperate", response = RedisOperateResDto.class)
	@PostMapping(value = "/redisOperate", produces = "application/json")
	@ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "RedisOperateReqVo") })
	public BaseResponseDTO<RedisOperateResDto> getM2Projects(HttpServletRequest request, @RequestBody RedisOperateReqVo reqVo){
		return (BaseResponseDTO<RedisOperateResDto>) redisOperateHander.hander(reqVo);
	}


	@ApiOperation(value = "获取楼盘的推荐人列表", response = GetPremisesDynamicResDto.class)
	@PostMapping(value = "/premises/recommenders/list", produces = "application/json")
	public BaseResponseDTO<PremisesRecommenderListResDto> premisesRecommenders(HttpServletRequest request, @RequestBody GetPremisesDetailReqVo reqVo){
		return (BaseResponseDTO<PremisesRecommenderListResDto>) premisesRecommenderListHander.hander(reqVo);
	}

    @ApiOperation(value = "获取楼盘详情推荐人信息", response = GetPremisesDynamicResDto.class)
    @PostMapping(value = "/premises/recommenders/info", produces = "application/json")
    public BaseResponseDTO<PremisesRecommenderListResDto> premisesRecommendersInfo(HttpServletRequest request, @RequestBody GetPremisesDetailReqVo reqVo){
        return (BaseResponseDTO<PremisesRecommenderListResDto>) premisesRecommenderInfoHander.hander(reqVo);
    }

	@ApiOperation(value = "添加楼盘的推荐人")
	@PostMapping(value = "/add/premises/recommenders", produces = "application/json")
	@ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "AddPremisesRecommenderReqVo") })
	public BaseResponseDTO addpremisesRecommenders(HttpServletRequest request, @RequestBody AddPremisesRecommenderReqVo reqVo){
		return addPremisesRecommenderHander.hander(reqVo);
	}

	@ApiOperation(value = "批量同步楼盘的推荐人")
	@PostMapping(value = "/batchsync/premises/recommenders", produces = "application/json")
	@ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "BatchAddPremisesRecommenderReqVo") })
	public BaseResponseDTO batchsyncPremisesRecommenders(HttpServletRequest request, @RequestBody BatchAddPremisesRecommenderReqVo reqVo){
		return batchAddPremisesRecommenderHander.hander(reqVo);
	}

	@ApiOperation(value = "取消楼盘的推荐人")
	@PostMapping(value = "/del/premises/recommenders", produces = "application/json")
	@ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "AddPremisesRecommenderReqVo") })
	public BaseResponseDTO delpremisesRecommenders(HttpServletRequest request, @RequestBody AddPremisesRecommenderReqVo reqVo){
		return delPremisesRecommenderHander.hander(reqVo);
	}

	@ApiOperation(value = "变更报备推荐人")
	@PostMapping(value = "/report/recommenders/recommenderChange", produces = "application/json")
	@ApiImplicitParams({ @ApiImplicitParam(name = "reqVo", value = "请求参数", dataType = "RecommenderChangeReqVo") })
	public BaseResponseDTO recommenderChange(HttpServletRequest request, @RequestBody RecommenderChangeReqVo reqVo){
		return recommenderChangeHander.hander(reqVo);
	}

	/**
	 *  本部机构用户根据权限获取楼盘集合
	 *
	 * @param request
	 * @param getPartnerBindPremisesReqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/getPremisesListForPartner", produces = "application/json")
	public String getPremisesListForPartner(HttpServletRequest request, @RequestBody GetPartnerBindPremisesReqVo getPartnerBindPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPremisesListForPartnerHander.hander(getPartnerBindPremisesReqVo));
		} catch (Exception e) {
			logger.error("getPremisesListForPartnerHander error: {}", e);
			return null;
		}
	}

	/**
	 * 获取所有楼盘推荐人列表
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@ApiOperation("获取所有楼盘推荐人列表")
	@PostMapping(value = "/premises/recommenders/all/list", produces = "application/json")
	public BaseResponseDTO<PremisesRecommenderListResDto> allPremisesRecommenders(HttpServletRequest request, @RequestBody GetPremisesDetailReqVo reqVo){
		return (BaseResponseDTO<PremisesRecommenderListResDto>) premisesRecommenderAllListHander.hander(reqVo);
	}

	/**
	 * 获取渠道所有的楼盘推荐人
	 *
	 * @method: getRecommenderList
	 * @param: [getDevPremisesExportReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("获取渠道所有的楼盘推荐人")
	@PostMapping(value = "/recommenders/getRecommenderList",produces = "application/json")
	public String getRecommenderList(@RequestBody GetPremisesDetailReqVo getPremisesDetailReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getRecommenderListHander.hander(getPremisesDetailReqVo));
		} catch (Exception e) {
			logger.error("getRecommenderList error: {}", e);
		}
		return null;
	}

	/**
	 * 通过楼盘状态获取满足状态的楼盘列表
	 *
	 * @method: getPremisesListByStatus
	 * @param: [getPartnerBindPremisesReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("通过楼盘状态获取满足状态的楼盘列表")
	@PostMapping(value = "/premises/getPremisesListByStatus",produces = "application/json")
	public String getPremisesListByStatus(@RequestBody GetPartnerBindPremisesReqVo getPartnerBindPremisesReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getPremisesListByStatusHander.hander(getPartnerBindPremisesReqVo));
		} catch (Exception e) {
			logger.error("getPremisesListByStatus error: {}", e);
		}
		return null;
	}

	/**
	 * 查找报备推荐业务数据
	 *
	 * @method: getReportRecommendByRec
	 * @param: [getDevPremisesExportReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation(value = "查找报备推荐业务数据")
	@PostMapping(value = "/getReportRecommend",produces = "application/json")
	public String getReportRecommend(@RequestBody GetDevPremisesExportReqVo getDevPremisesExportReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getReportRecommendHander.hander(getDevPremisesExportReqVo));
		} catch (Exception e) {
			logger.error("getReportRecommend error: {}", e);
		}
		return null;
	}

	/**
	 * 根据省份市区、楼盘查询可报备的楼盘
	 *
	 * @method: getAgentPremisesList
	 * @param: [findPremisesListReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("根据省份市区、楼盘查询可报备的楼盘")
	@PostMapping(value = "/agent/getAgentPremisesList",produces = "application/json")
	public String getAgentPremisesList(@RequestBody GetAgentPremisesPageReqVo findPremisesListReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getAgentPremisesListHander.hander(findPremisesListReqVo));
		} catch (Exception e) {
			logger.error("getAgentPremisesList error: {}", e);
		}
		return null;
	}

	/**
	 * 校验批量报备
	 *
	 * @method: checkReportList
	 * @param: [batchReportReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("校验批量报备")
	@PostMapping(value = "/agent/checkReportList",produces = "application/json")
	public String checkReportList(@RequestBody BatchReportReqVo batchReportReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(checkReportListHander.hander(batchReportReqVo));
		} catch (Exception e) {
			logger.error("checkReportList error: {}", e);
		}
		return null;
	}

	/**
	 * 生成报备信息
	 *
	 * @method: addBatchReport
	 * @param: [batchReportReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("生成报备信息")
	@PostMapping(value = "/agent/addBatchReport",produces = "application/json")
	public String addBatchReport(@RequestBody BatchReportReqVo batchReportReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(addBatchReportHander.hander(batchReportReqVo));
		} catch (Exception e) {
			logger.error("addBatchReport error: {}", e);
		}
		return null;
	}

	/**
	 * 查询到访数据报表
	 *
	 * @method: getVisitStateList
	 * @param: [GetVisitStateReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("查询到访数据报表")
	@PostMapping(value = "/getVisitStateList",produces = "application/json")
	public String getVisitStateList(@RequestBody GetVisitStateReqVo getVisitStateReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(getVisitStateListHander.hander(getVisitStateReqVo));
		} catch (Exception e) {
			logger.error("getVisitStatePage error: {}", e);
		}
		return null;
	}

	/**
	 * 导出到访数据报表
	 *
	 * @method: exportVisitState
	 * @param: [getVisitStateReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("导出到访数据报表")
	@GetMapping(value = "/exportVisitState",produces = "application/json")
	public void exportVisitState(GetVisitStateReqVo getVisitStateReqVo,HttpServletResponse response) {
		try {
			BaseResponseDTO<GetVisitStateResDto> dto = getVisitStateListHander.hander(getVisitStateReqVo);
			List<VisitStateInfo> infoList = dto.getResData().getGetVisitStateList();
			String startDate = dto.getResData().getStartDate();
			String endDate = dto.getResData().getEndDate();

			// 组装导出数据
			// sheet
			String[] name = new String[] {"统计时间截止至"};
			// 表头
			List<String[]> headerList = new ArrayList<>();
			// 数据
			List<List<Map<String, String>>> list = new ArrayList<>();

			// 项目客户推荐表
			String[] header = new String[] {"到访类型","到访数量","签约成功数","签约成功率"};
			headerList.add(header);

			BigDecimal totalOne = new BigDecimal("0");
			BigDecimal totalTwo = new BigDecimal("0");
			BigDecimal totalThree = new BigDecimal("0");
			String signRate = null;
			List<Map<String, String>> mapList = new ArrayList<>();
			for (int i = 0; i < infoList.size(); i++) {
				VisitStateInfo vs = infoList.get(i);
				Map<String, String> map = new HashMap<>();
				map.put(header[0] + "_" + i, vs.getVisitType());

				String countOne = vs.getVisitCount() + "";
				totalOne = totalOne.add(new BigDecimal(countOne));
				map.put(header[1] + "_" + i, countOne);
				String countTwo = vs.getSignCount() + "";
				totalTwo = totalTwo.add(new BigDecimal(countTwo));
				map.put(header[2] + "_" + i, countTwo);

				signRate = CalculateUtil.signRate(countOne,countTwo);
				map.put(header[3] + "_" + i, signRate);
				mapList.add(map);
			}
			Map<String, String> totalMap = new HashMap<>();
			totalMap.put(header[0] + "_" + mapList.size(), "合计");
			totalMap.put(header[1] + "_" + mapList.size(), totalOne.toString());
			totalMap.put(header[2] + "_" + mapList.size(), totalTwo.toString());

			mapList.add(totalMap);
			list.add(mapList);

			// 推荐人业务报表统计时间
			if (StringUtils.isEmpty(startDate)) {
				startDate = "";
			}
			String fileName = "到访数据报表(" + startDate + "至" + endDate + ")";
			name[0] += endDate;
			// 组装excel
			Export.exportDevPremisesInfo(list, headerList, name, fileName, response);
		} catch (Exception e) {
			logger.error("exportVisitState error: {}", e);
		}
	}

	/**
	 * 分销管理员转移
	 *
	 * @method: adminTransfer
	 * @param: [adminTransferReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("分销管理员转移")
	@PostMapping(value = "/agent/adminTransfer",produces = "application/json")
	public String adminTransfer(@RequestBody AdminTransferReqVo adminTransferReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(adminTransferHander.hander(adminTransferReqVo));
		} catch (Exception e) {
			logger.error("adminTransfer error: {}", e);
		}
		return null;
	}

	/**
	 * 修改
	 *
	 * @method: adminTransfer
	 * @param: [adminTransferReqVo]
	 * @return: java.lang.String
	 */
	@ApiOperation("分销管理员转移")
	@PostMapping(value = "/agent/updateAccountType",produces = "application/json")
	public String updateAccountTypeHander(@RequestBody UpdateAccountTypeReqVo updateAccountTypeReqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(updateAccountTypeHander.hander(updateAccountTypeReqVo));
		} catch (Exception e) {
			logger.error("updateAccountType error: {}", e);
		}
		return null;
	}
	/**
	 * @param request
	 * @param reqVo
	 * @description 获取验真短信
	 * @author jhsong
	 * @date 2017/12/1
	 **/
	@ApiOperation("获取手机号验真短信")
	@PostMapping(value = "/sendMobileCheckCode", produces = "application/json")
	public String sendMobileCheckCode(HttpServletRequest request, @RequestBody SendMobileCheckCodeReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(sendMobileCheckCodeHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("sendMobileCheckCode error: {}", e);
		}
		return null;
	}

	/**
	 * @param request
	 * @param reqVo
	 * @description 获取验真短信
	 * @author jhsong
	 * @date 2017/12/1
	 **/
	@ApiOperation("校验手机号验真短信")
	@PostMapping(value = "/checkMobileCheckCode", produces = "application/json")
	public String checkMobileCheckCode(HttpServletRequest request, @RequestBody CheckMobileCheckCodeReqVo reqVo) {
		try {
			return JSONUtil.toJSONStringWithDateFormat(checkMobileCheckCodeHander.hander(reqVo));
		} catch (Exception e) {
			logger.error("sendMobileCheckCode error: {}", e);
		}
		return null;
	}


	@ApiOperation(value = "获取楼盘置业顾问", response = GetPremisesDynamicResDto.class)
	@PostMapping(value = "/premises/adviser/list", produces = "application/json")
	public BaseResponseDTO<EstateAdviserListResDto> getEstateAdviserList(HttpServletRequest request, @RequestBody GetPremisesDetailReqVo reqVo){
		return (BaseResponseDTO<EstateAdviserListResDto>) estateAdviserListHander.hander(reqVo);
	}

	@ApiOperation(value = "删除楼盘置业顾问", response = GetPremisesDynamicResDto.class)
	@PostMapping(value = "/premises/adviser/del", produces = "application/json")
	public BaseResponseDTO<CommonResDTO> delAdviser(HttpServletRequest request, @RequestBody EditEstateAdviserReqVo reqVo){
		return (BaseResponseDTO<CommonResDTO>) editEstateAdviserHander.hander(reqVo);
	}

	@ApiOperation(value = "变更置业顾问", response = GetPremisesDynamicResDto.class)
	@PostMapping(value = "/premises/adviser/changeCPAdviser", produces = "application/json")
	public BaseResponseDTO<CommonResDTO> changeCPAdviser(HttpServletRequest request, @RequestBody ChangeCPAdviserReqVo reqVo){
		return (BaseResponseDTO<CommonResDTO>) changeCPAdviserHander.hander(reqVo);
	}

	@ApiOperation(value = "置业顾问绑定报备数量", response = GetPremisesDynamicResDto.class)
	@PostMapping(value = "/premises/adviser/getCPCountByAdviser", produces = "application/json")
	public BaseResponseDTO<GetCPCountByAdviserResDto> getCPCountByAdviser(HttpServletRequest request, @RequestBody GetCPCountByAdviserReqVo reqVo){
		return (BaseResponseDTO<GetCPCountByAdviserResDto>) getCPCountByAdviserHander.hander(reqVo);
	}

	/**
	 * 修改或新增消息到期提醒配置
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@Domain
	@PostMapping(value = "/dueRemainderConfig/updateOrInsert", produces = "application/json")
	public BaseResponseDTO<UpdateDueRemainderResDto> updateDueRemainderConfig(HttpServletRequest request, @RequestBody DueRemainderConfigVo reqVo){
		return (BaseResponseDTO<UpdateDueRemainderResDto>) updateDueRemainderHander.hander(reqVo);
	}
	
	/**
	 *   获取驻场员工的楼盘信息并返回
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@ApiOperation(value="获取驻场员工的楼盘信息并返回", response = PremisesAndCaseMemberResDto.class)
	@ApiImplicitParams({@ApiImplicitParam(name="reqVo", value="请求参数", dataType = "StaffPrimiseRelVo") })
	@PostMapping(value = "/staff/getPremisesAndCaseMemberByStaffId", produces = "application/json")
	public BaseResponseDTO<PremisesAndCaseMemberResDto> getPremisesAndCaseMemberByStaffId(HttpServletRequest request, @RequestBody StaffPrimiseRelReqVo reqVo){
		return (BaseResponseDTO<PremisesAndCaseMemberResDto>) getPremisesAndCaseMemberByStaffIdHandler.hander(reqVo);
	}
	
	/**
	 *   获取驻场员工的楼盘信息并返回
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@ApiOperation(value="批量修改驻场人员的微信订阅信息", response = UpdateCaseMemberResDto.class)
	@ApiImplicitParams({@ApiImplicitParam(name="reqVo", value="请求参数", dataType = "BatchUpdateCaseMemberVo") })
	@PostMapping(value = "/caseMember/batchUpdateCaseMember", produces = "application/json")
	public BaseResponseDTO<UpdateCaseMemberResDto> batchUpdateCaseMember(HttpServletRequest request, @RequestBody BatchUpdateCaseMemberVo reqVo){
		return (BaseResponseDTO<UpdateCaseMemberResDto>) batchUpdateCaseMember.hander(reqVo);
	}

	/**
	 *   批量更改员工驻场信息
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@ApiOperation(value="批量更改员工驻场信息", response = UpdateCaseMemberResDto.class)
	@ApiImplicitParams({@ApiImplicitParam(name="reqVo", value="请求参数", dataType = "BatchUpdateCaseMemberPremisesVo") })
	@PostMapping(value = "/caseMember/batchUpdateCaseMemberPremises", produces = "application/json")
	public BaseResponseDTO<UpdateCaseMemberResDto> batchUpdateCaseMemberPremises(HttpServletRequest request, @RequestBody BatchUpdateCaseMemberPremisesVo reqVo){
		return (BaseResponseDTO<UpdateCaseMemberResDto>) batchUpdateCaseMemberPremisesHandler.hander(reqVo);
	}

	/**
	 *   批量更改楼盘驻场信息
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@ApiOperation(value="批量更改楼盘驻场信息", response = BindPartnerToPremisesResDto.class)
	@ApiImplicitParams({@ApiImplicitParam(name="reqVo", value="请求参数", dataType = "BatchUpdateCaseMemberPremisesVo") })
	@PostMapping(value = "/batchAddDefendForPremises", produces = "application/json")
	public BaseResponseDTO<BindPartnerToPremisesResDto> batchAddDefendForPremises(HttpServletRequest request, @RequestBody BatchUpdateCaseMemberPremisesVo reqVo){
		return (BaseResponseDTO<BindPartnerToPremisesResDto>) addPremisesDefendHander.hander(reqVo);
	}
	
	/**
	 *   批量更改楼盘驻场信息
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@ApiOperation(value="获取七牛上传凭证", response = BindPartnerToPremisesResDto.class)
	@PostMapping(value = "/getQiniuUploadToken", produces = "application/json")
	public BaseResponseDTO<GetQiniuUploadTokenResDto> getQiniuUploadToken(HttpServletRequest request, @RequestBody GetQiniuUploadTokenReqVo reqVo){
		return (BaseResponseDTO<GetQiniuUploadTokenResDto>) getQiniuUploadTokenHander.hander(reqVo);
	}
	
	/**
	 * 更改公司简介
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@Domain
	@ApiOperation(value="更改公司简介", response = UpdateAccountTypeResDto.class)
	@PostMapping(value = "/updateCompanyAbbreviation", produces = "application/json")
	public BaseResponseDTO<UpdateAccountTypeResDto> updateCompanyAbbreviation(HttpServletRequest request, @RequestBody UpdateCompanyAbbreviationReqVo reqVo){
		return (BaseResponseDTO<UpdateAccountTypeResDto>) updateCompanyAbbreviationHander.hander(reqVo);
	}
	
	/**
	 * 根据手机号码，总代companyUuid查询对应经纪人信息
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@Domain
	@ApiOperation(value="根据手机号码，总代companyUuid查询对应经纪人信息", response = GetAgentInfoResDto.class)
	@PostMapping(value = "/getAgentInfo", produces = "application/json")
	public BaseResponseDTO<GetAgentInfoResDto> getAgentInfo(HttpServletRequest request, @RequestBody GetAgentInfoReqVo reqVo){
		return (BaseResponseDTO<GetAgentInfoResDto>) getAgentInfoHander.hander(reqVo);
	}
	
	
	/**
	 * 获取分销机构二维码链接
	 * @param reqVo
	 * @return
	 */
	@Domain
	@ApiOperation(value="获取分销机构二维码链接")
	@PostMapping("/getDepartmentQrCodeUrl")
	public BaseResponseDTO<String> getDepartmentQrCodeUrl(HttpServletRequest request, @RequestBody GeneralLongReqVo reqVo) {
		
		String fileUrl = myService.getQrCodeUrl(reqVo.getParams().getUserId(), 
				reqVo.getParams().getId(), reqVo.getParams().getCompanyUuid(), "partnerDeptQrcodeService");
		// 从缓存获取上传到七牛的URL
		BaseResponseDTO<String> res = new BaseResponseDTO<>();
		
		if(fileUrl.indexOf("失败") > -1) {
			res.setErrorMsg(fileUrl);
			res.setResult(ResultEnum.FAIL.getNo());
			return res;
		}
		
		res.setResData(fileUrl);
		res.setResult(ResultEnum.SUCCESS.getNo());
		return res;
	}

	/**
	 * 楼盘动态上传图片
	 *
	 * @param mulRequest
	 * @return
	 * @throws IOException
	 */
	@PostMapping(value = "/dynamicUploadBase64", produces = "application/json")
	public String dynamicUploadBase64(MultipartHttpServletRequest mulRequest) {
		BaseResponseDTO<UploadBase64ResDto> res = new BaseResponseDTO<>();
		UploadBase64ResDto resDto = new UploadBase64ResDto();
		try {
			Iterator<String> fileNames = mulRequest.getFileNames();
			byte[] imgByte = null;
			// 遍历请求中的图片信息
			if (fileNames.hasNext()) {
				// 图片对应的参数名
				String fileName = fileNames.next();
				// 获取到图片
				MultipartFile file = mulRequest.getFile(fileName);
				if (file != null) {
					//读取图片
					BufferedInputStream bis = new BufferedInputStream(file.getInputStream());
					//字节流转换成图片
					BufferedImage imageIo = ImageIO.read(bis);

					int imageWidth = imageIo.getWidth();
					int imageHeight = imageIo.getHeight();
					int newImageWidth = 1080;
					//如果图片宽度大于1080，改成1080宽度
					if(imageWidth > newImageWidth) {
						logger.info("=====================图片宽度{}", imageWidth);
						logger.info("=====================图片长度{}", imageHeight);

						//获取当前日期
						SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
						String date = sdf.format(System.currentTimeMillis());
						// 获取图片保存路径
						String realPath = fileConfig.getFileSet()+File.separator+"default"+File.separator+date;
						// 创建图片文件夹（文件夹名格式  yyyyMMdd ）
						FileUtils.fileIsMkdirs(realPath);
						// 获取图片保存路径
						//String realPath = System.getProperties().getProperty("user.dir")+;

						//获取文件名后缀
						String fileSuffix = StringUtils.substringAfterLast(file.getOriginalFilename(), ".");

						File newFile = new File(realPath, UuidUtil.geneUuidString()+"."+fileSuffix);

						//构建图片流
						BufferedImage tag = new BufferedImage(newImageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
						//绘制改变尺寸后的图
						tag.getGraphics().drawImage(imageIo, 0, 0, newImageWidth, imageHeight, null);
						//输出图片
						BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(newFile));

						ImageIO.write(tag, fileSuffix, bos);
						bis.close();
						bos.close();
						InputStream inputStream = new FileInputStream(newFile);

						file = new MockMultipartFile(newFile.getName(), inputStream);
					}
					logger.info("upload dynamic file,file set {}", fileConfig.getFileSet());
					String result = HttpApi.doPostForFile(file,fileConfig.getFileSet());
					logger.info("upload dynamic file,result {}", result);
					if(result != null ){
						return result;
					}
					// 可以获取到图片的字节数组
					imgByte = file.getBytes();
				}
			}
		} catch (Exception e) {
			logger.error("上传图片失败: {}", e);
			res.setResult(ResultEnum.FAIL.getNo());
			res.setErrorMsg("上传图片失败");
		}
		return JSONUtil.toJSONStringWithDateFormat(res);
	}
	
	/**
	 * 获取分销规则
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@Domain
	@SuppressWarnings("unchecked")
	@ApiOperation(value="获取分销规则", response = GetAgentRuleResDto.class)
	@PostMapping(value = "/getAgentRule", produces = "application/json")
	public BaseResponseDTO<GetAgentRuleResDto> getAgentRule(HttpServletRequest request, @RequestBody GeneralReqVo<CommonReqDTO> reqVo){
		return (BaseResponseDTO<GetAgentRuleResDto>) getAgentRuleHander.hander(reqVo);
	}
	
	@SuppressWarnings("unchecked")
	@ApiOperation(value="保存经纪人审核规则", response = String.class)
	@PostMapping(value = "/savePartnerCheckRule", produces = "application/json")
	public BaseResponseDTO<String> savePartnerCheckRule(HttpServletRequest request, @RequestBody SavePartnerCheckRuleReqVo reqVo){
		return (BaseResponseDTO<String>) savePartnerCheckRuleHander.hander(reqVo);
	}
	
	@SuppressWarnings("unchecked")
	@ApiOperation(value="保存自定义模板", response = String.class)
	@PostMapping(value = "/saveModel", produces = "application/json")
	public BaseResponseDTO<String> saveModel(HttpServletRequest request, @RequestBody SaveModelReqVo reqVo){
		return (BaseResponseDTO<String>) saveModelHander.hander(reqVo);
	}
	
	@SuppressWarnings("unchecked")
	@ApiOperation(value="获取审核列表", response = PartnerCheckPageResDto.class)
	@PostMapping(value = "/getCheckList", produces = "application/json")
	public BaseResponseDTO<PartnerCheckPageResDto> getCheckList(HttpServletRequest request, @RequestBody GetCheckListReqVo reqVo){
		return (BaseResponseDTO<PartnerCheckPageResDto>) getCheckListHander.hander(reqVo);
	}
	
	@Domain
	@SuppressWarnings("unchecked")
	@ApiOperation(value="人员审核", response = String.class)
	@PostMapping(value = "/partnerCheck", produces = "application/json")
	public BaseResponseDTO<String> partnerCheck(HttpServletRequest request, @RequestBody PartnerCheckReqVo reqVo){
		return (BaseResponseDTO<String>) partnerCheckHander.hander(reqVo);
	}
	
	@SuppressWarnings("unchecked")
	@ApiOperation(value="获取部门等级树", response = String.class)
	@PostMapping(value = "/getLevelDeptTree", produces = "application/json")
	public BaseResponseDTO<LevelDeptTreeResDto> getLevelDeptTree(HttpServletRequest request, @RequestBody GeneralReqVo<CommonReqDTO> reqVo){
		return (BaseResponseDTO<LevelDeptTreeResDto>) getLevelDeptTreeHander.hander(reqVo);
	}
	
	@Domain
	@SuppressWarnings("unchecked")
	@ApiOperation(value="保存是否开启分销公司注册规则", response = String.class)
	@PostMapping(value = "/saveAgentCompanyRegesitRule", produces = "application/json")
	public BaseResponseDTO<String> saveAgentCompanyRegesitRule(HttpServletRequest request, @RequestBody SaveAgentCompanyRegesitReqVo reqVo){
		return (BaseResponseDTO<String>) saveAgentCompanyRegesitHander.hander(reqVo);
	}
	
	@SuppressWarnings("unchecked")
	@ApiOperation(value="获取公司注册列表", response = String.class)
	@PostMapping(value = "/getAgentCompanyRegesitList", produces = "application/json")
	public BaseResponseDTO<GetAgentCompanyRegesitListResDto> getAgentCompanyRegesitList(HttpServletRequest request, @RequestBody GetAgentCompanyRegesitListReqVo reqVo){
		return (BaseResponseDTO<GetAgentCompanyRegesitListResDto>) getAgentCompanyRegesitListHander.hander(reqVo);
	}
	
	@SuppressWarnings("unchecked")
	@ApiOperation(value="编辑分销公司的营业执照", response = String.class)
	@PostMapping(value = "/updateCompanyCredential", produces = "application/json")
	public BaseResponseDTO<String> updateCompanyCredential(HttpServletRequest request, @RequestBody UpdateCompanyCredentialReqVo reqVo){
		return (BaseResponseDTO<String>) updateCompanyCredentialHander.hander(reqVo);
	}
	
	/**
	 * 根据模板名称获取对应公司的自定义模板
	 * @param request
	 * @param reqVo
	 * @return
	 */
	@Domain
	@SuppressWarnings("unchecked")
	@ApiOperation(value="根据模板名称获取对应公司的自定义模板", response = ModelListResDto.class)
	@PostMapping(value = "/getModelByNameAndType", produces = "application/json")
	public BaseResponseDTO<ModelListResDto> getModelByNameAndType(HttpServletRequest request, @RequestBody GetModelByNameAndTypeReqVo reqVo){
		return (BaseResponseDTO<ModelListResDto>) getModelByNameHander.hander(reqVo);
	}
	
	@Domain
	@SuppressWarnings("unchecked")
	@ApiOperation(value="分销公司审核", response = String.class)
	@PostMapping(value = "/agentCompanyCheck", produces = "application/json")
	public BaseResponseDTO<String> agentCompanyCheck(HttpServletRequest request, @RequestBody AgentCompanyCheckReqVo reqVo){
		return (BaseResponseDTO<String>) agentCompanyCheckHander.hander(reqVo);
	}
	
}
